public function ViewEditFormController::submitDisplayUndoDelete

Submit handler to add a restore a removed display to a view.

File

drupal/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php, line 554
Contains Drupal\views_ui\ViewEditFormController.

Class

ViewEditFormController
Form controller for the Views edit form.

Namespace

Drupal\views_ui

Code

public function submitDisplayUndoDelete($form, &$form_state) {
  $view = $this->entity;

  // Create the new display
  $id = $form_state['display_id'];
  $displays = $view
    ->get('display');
  $displays[$id]['deleted'] = FALSE;
  $view
    ->set('display', $displays);

  // Store in cache
  $view
    ->cacheSet();

  // Redirect to the top-level edit page.
  $form_state['redirect'] = 'admin/structure/views/view/' . $view
    ->id() . '/edit/' . $id;
}