MenuTreeStorage::delete
public function MenuTreeStorage::delete
public MenuTreeStorage::delete($id)
Deletes a menu link definition from the storage.
Parameters
string $id: The menu link plugin ID.
Overrides MenuTreeStorageInterface::delete
File
- core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 398
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
public function delete($id) { // Children get re-attached to the menu link's parent. $item = $this->loadFull($id); // It's possible the link is already deleted. if ($item) { $parent = $item['parent']; $children = $this->loadByProperties(array('parent' => $id)); foreach ($children as $child) { $child['parent'] = $parent; $this->save($child); } $this->doDeleteMultiple([$id]); $this->updateParentalStatus($item); // Many children may have moved. $this->resetDefinitions(); $this->cacheTagsInvalidator->invalidateTags(['config:system.menu.' . $item['menu_name']]); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!MenuTreeStorage.php/function/MenuTreeStorage::delete/8.1.x