You are here

public function WebformDialogFormTrait::cancelAjaxForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Form/WebformDialogFormTrait.php \Drupal\webform\Form\WebformDialogFormTrait::cancelAjaxForm()

Cancel form #ajax callback.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

\Drupal\Core\Ajax\AjaxResponse An Ajax response that display validation error messages or redirects to a URL

Overrides WebformAjaxFormTrait::cancelAjaxForm

1 method overrides WebformDialogFormTrait::cancelAjaxForm()
WebformSubmissionForm::cancelAjaxForm in src/WebformSubmissionForm.php
Cancel form #ajax callback.

File

src/Form/WebformDialogFormTrait.php, line 122

Class

WebformDialogFormTrait
Trait for webform dialog support.

Namespace

Drupal\webform\Form

Code

public function cancelAjaxForm(array &$form, FormStateInterface $form_state) {
  $response = $this
    ->createAjaxResponse($form, $form_state);
  $response
    ->addCommand(new CloseDialogCommand());
  return $response;
}