public static function MenuLinkContent::preDelete in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/menu_link_content/src/Entity/MenuLinkContent.php \Drupal\menu_link_content\Entity\MenuLinkContent::preDelete()
Acts on entities before they are deleted and before hooks are invoked.
Used before the entities are deleted and before invoking the delete hook.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
Overrides Entity::preDelete
File
- core/
modules/ menu_link_content/ src/ Entity/ MenuLinkContent.php, line 218 - Contains \Drupal\menu_link_content\Entity\MenuLinkContent.
Class
- MenuLinkContent
- Defines the menu link content entity class.
Namespace
Drupal\menu_link_content\EntityCode
public static function preDelete(EntityStorageInterface $storage, array $entities) {
parent::preDelete($storage, $entities);
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
foreach ($entities as $menu_link) {
/** @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_link */
$menu_link_manager
->removeDefinition($menu_link
->getPluginId(), FALSE);
}
}