function menu_menu_predelete

Implements hook_menu_predelete().

File

drupal/core/modules/menu/menu.module, line 280
Allows administrators to customize the site's navigation menus.

Code

function menu_menu_predelete(Menu $menu) {

  // Delete all links from the menu.
  menu_delete_links($menu
    ->id());

  // Remove menu from active menus variable.
  $active_menus = variable_get('menu_default_active_menus', array_keys(menu_get_menus()));
  foreach ($active_menus as $i => $menu_name) {
    if ($menu
      ->id() == $menu_name) {
      unset($active_menus[$i]);
      variable_set('menu_default_active_menus', $active_menus);
    }
  }
}