function ConditionConfigure::ajaxSave

Same name in other branches
  1. 8.x-3.x src/Form/ConditionConfigure.php \Drupal\ctools\Form\ConditionConfigure::ajaxSave()

Ajax callback to save tempstore values.

Parameters

array $form: The Drupal Form.

\Drupal\Core\Form\FormStateInterface $form_state: The Form state.

Return value

\Drupal\Core\Ajax\AjaxResponse Ajax values from tempstore.

File

src/Form/ConditionConfigure.php, line 150

Class

ConditionConfigure
Base class for condition configur operations.

Namespace

Drupal\ctools\Form

Code

public function ajaxSave(array &$form, FormStateInterface $form_state) {
    $response = new AjaxResponse();
    $cached_values = $this->tempstore
        ->get($this->tempstore_id)
        ->get($this->machine_name);
    [
        $route_name,
        $route_parameters,
    ] = $this->getParentRouteInfo($cached_values);
    $url = Url::fromRoute($route_name, $route_parameters);
    $response->addCommand(new RedirectCommand($url->toString()));
    $response->addCommand(new CloseModalDialogCommand());
    return $response;
}