function MenuLinkContentHooks::menuDelete

Implements hook_menu_delete().

File

core/modules/menu_link_content/src/Hook/MenuLinkContentHooks.php, line 57

Class

MenuLinkContentHooks
Hook implementations for menu_link_content.

Namespace

Drupal\menu_link_content\Hook

Code

public function menuDelete(MenuInterface $menu) {
    $storage = \Drupal::entityTypeManager()->getStorage('menu_link_content');
    $menu_links = $storage->loadByProperties([
        'menu_name' => $menu->id(),
    ]);
    $storage->delete($menu_links);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.