public static function OgMenuInstance::preDelete in Organic Groups Menu (OG Menu) 8
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 EntityBase::preDelete
File
- src/
Entity/ OgMenuInstance.php, line 110 - Contains \Drupal\og_menu\Entity\OgMenuInstance.
Class
- OgMenuInstance
- Defines the OG Menu instance entity.
Namespace
Drupal\og_menu\EntityCode
public static function preDelete(EntityStorageInterface $storage, array $entities) {
/** @var \Drupal\Core\Entity\EntityInterface $entity */
foreach ($entities as $entity) {
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
$menu_link_manager
->deleteLinksInMenu('ogmenu-' . $entity
->id());
}
}