You are here

trait CloseDialogTrait in Purge 8.3

Shares the closeDialog AJAX form callback.

Hierarchy

See also

\Drupal\purge_ui\Form\PurgerAddForm

\Drupal\purge_ui\Form\DeletePurgerForm

\Drupal\purge_ui\Form\PurgerConfigFormBase

File

modules/purge_ui/src/Form/CloseDialogTrait.php, line 16

Namespace

Drupal\purge_ui\Form
View source
trait CloseDialogTrait {

  /**
   * Respond a CloseModalDialogCommand to close the modal dialog.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @return \Drupal\Core\Ajax\AjaxResponse
   *   The AJAX response object.
   */
  public function closeDialog(array &$form, FormStateInterface $form_state) {
    $response = new AjaxResponse();
    $response
      ->addCommand(new CloseModalDialogCommand());
    return $response;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CloseDialogTrait::closeDialog public function Respond a CloseModalDialogCommand to close the modal dialog.