function RelationshipConfigure::ajaxSave

Same name in other branches
  1. 4.0.x src/Form/RelationshipConfigure.php \Drupal\ctools\Form\RelationshipConfigure::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/RelationshipConfigure.php, line 135

Class

RelationshipConfigure
Configure Relationship Form.

Namespace

Drupal\ctools\Form

Code

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