public function ViewEditForm::submitDisplayDelete in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views_ui/src/ViewEditForm.php \Drupal\views_ui\ViewEditForm::submitDisplayDelete()
- 10 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 656
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'));
}