function menu_enable
7.x menu.module | menu_enable() |
6.x menu.module | menu_enable() |
Implementation of hook_enable()
Add a link for each custom menu.
1 call to menu_enable()
- system_update_6021 in drupal-6.x/
modules/ system/ system.install - Migrate the menu items from the old menu system to the new menu_links table.
1 string reference to 'menu_enable'
- system_update_6021 in drupal-6.x/
modules/ system/ system.install - Migrate the menu items from the old menu system to the new menu_links table.
File
- drupal-6.x/
modules/ menu/ menu.module, line 163 - Allows administrators to customize the site navigation menu.
Code
function menu_enable() {
menu_rebuild();
$base_link = db_fetch_array(db_query("SELECT mlid AS plid, menu_name from {menu_links} WHERE link_path = 'admin/build/menu' AND module = 'system'"));
$base_link['router_path'] = 'admin/build/menu-customize/%';
$base_link['module'] = 'menu';
$result = db_query("SELECT * FROM {menu_custom}");
while ($menu = db_fetch_array($result)) {
// $link is passed by reference to menu_link_save(), so we make a copy of $base_link.
$link = $base_link;
$link['mlid'] = 0;
$link['link_title'] = $menu['title'];
$link['link_path'] = 'admin/build/menu-customize/' . $menu['menu_name'];
if (!db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s' AND plid = %d", $link['link_path'], $link['plid']))) {
menu_link_save($link);
}
}
menu_cache_clear_all();
}