function ViewEditForm::submitDisplayDelete
Same name in other branches
- 9 core/modules/views_ui/src/ViewEditForm.php \Drupal\views_ui\ViewEditForm::submitDisplayDelete()
- 8.9.x core/modules/views_ui/src/ViewEditForm.php \Drupal\views_ui\ViewEditForm::submitDisplayDelete()
- 11.x core/modules/views_ui/src/ViewEditForm.php \Drupal\views_ui\ViewEditForm::submitDisplayDelete()
Submit handler to delete a display from a view.
File
-
core/
modules/ views_ui/ src/ ViewEditForm.php, line 701
Class
- ViewEditForm
- Form controller for the Views edit form.
Namespace
Drupal\views_uiCode
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->toUrl('edit-form'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.