public function ViewEditFormController::submitDisplayAdd

Submit handler to add a display to a view.

File

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

Class

ViewEditFormController
Form controller for the Views edit form.

Namespace

Drupal\views_ui

Code

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

  // Create the new display.
  $parents = $form_state['triggering_element']['#parents'];
  $display_type = array_pop($parents);
  $display_id = $view
    ->addDisplay($display_type);

  // A new display got added so the asterisks symbol should appear on the new
  // display.
  $view
    ->get('executable')->current_display = $display_id;
  $view
    ->cacheSet();

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