function ContextConfigure::ajaxSave

Same name and namespace in other branches
  1. 4.0.x src/Form/ContextConfigure.php \Drupal\ctools\Form\ContextConfigure::ajaxSave()

Ajax Save Method.

Parameters

array $form: Drupal Form.

\Drupal\Core\Form\FormStateInterface $form_state: Form State.

Return value

\Drupal\Core\Ajax\AjaxResponse The ajax data in the response.

File

src/Form/ContextConfigure.php, line 233

Class

ContextConfigure
Configure Context Form.

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 = new Url($route_name, $route_parameters);
  $response->addCommand(new RedirectCommand($url->toString()));
  $response->addCommand(new CloseModalDialogCommand());
  return $response;
}