You are here

public function ViewEditForm::cancel in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views_ui/src/ViewEditForm.php \Drupal\views_ui\ViewEditForm::cancel()
  2. 10 core/modules/views_ui/src/ViewEditForm.php \Drupal\views_ui\ViewEditForm::cancel()

Form submission handler for the 'cancel' action.

Parameters

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

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

File

core/modules/views_ui/src/ViewEditForm.php, line 353

Class

ViewEditForm
Form controller for the Views edit form.

Namespace

Drupal\views_ui

Code

public function cancel(array $form, FormStateInterface $form_state) {

  // Remove this view from cache so edits will be lost.
  $view = $this->entity;
  $this->tempStore
    ->delete($view
    ->id());
  $form_state
    ->setRedirectUrl($this->entity
    ->toUrl('collection'));
}