ViewEditForm::submitDisplayDelete

public ViewEditForm::submitDisplayDelete($form, FormStateInterface $form_state)

Submit handler to delete a display from a view.

File

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

Class

ViewEditForm
Form controller for the Views edit form.

Namespace

Drupal\views_ui

Code

public function submitDisplayDelete($form, FormStateInterface $form_state) {
  $view = $this->entity;
  $display_id = $form_state->get('display_id');

  // Mark the display for deletion.
  $displays = $view->get('display');
  $displays[$display_id]['deleted'] = TRUE;
  $view->set('display', $displays);
  $view->cacheSet();

  // Redirect to the top-level edit page. The first remaining display will
  // become the active display.
  $form_state->setRedirectUrl($view->urlInfo('edit-form'));
}
doc_Drupal
2016-10-29 09:54:00
Comments
Leave a Comment

Please login to continue.