function ResolverRelationshipConfigure::ajaxSave

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

Class

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