function menu_link_content_menu_delete

Same name and namespace in other branches
  1. 9 core/modules/menu_link_content/menu_link_content.module \menu_link_content_menu_delete()
  2. 8.9.x core/modules/menu_link_content/menu_link_content.module \menu_link_content_menu_delete()
  3. 10 core/modules/menu_link_content/menu_link_content.module \menu_link_content_menu_delete()

Implements hook_menu_delete().

File

core/modules/menu_link_content/menu_link_content.module, line 47

Code

function menu_link_content_menu_delete(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.