public MenuDeleteForm::submitForm(array &$form, FormStateInterface $form_state)
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state can be updated, this way the subsequently invoked handlers can retrieve a regular entity object to act on. Generally this method should not be overridden unless the entity requires the same preparation for two actions, see \Drupal\comment\CommentForm for an example with the save and preview actions.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides EntityDeleteFormTrait::submitForm
File
- core/modules/menu_ui/src/Form/MenuDeleteForm.php, line 76
Class
- MenuDeleteForm
- Defines a confirmation form for deletion of a custom menu.
Namespace
Drupal\menu_ui\Form
Code
public function submitForm(array &$form, FormStateInterface $form_state) { // Locked menus may not be deleted. if ($this->entity->isLocked()) { return; } // Delete all links to the overview page for this menu. // @todo Add a more generic helper function to the menu link plugin // manager to remove links to a entity or other ID used as a route // parameter that is being removed. Also, consider moving this to // menu_ui.module as part of a generic response to entity deletion. // https://www.drupal.org/node/2310329 $menu_links = $this->menuLinkManager->loadLinksByRoute('entity.menu.edit_form', array('menu' => $this->entity->id()), TRUE); foreach ($menu_links as $id => $link) { $this->menuLinkManager->removeDefinition($id); } parent::submitForm($form, $form_state); }
Please login to continue.