function menu_block_fix_custom_menus in Menu Block 7.2
Same name and namespace in other branches
- 7.3 menu_block.install \menu_block_fix_custom_menus()
Helper function to fix custom menus in Drupal 7.0.
1 call to menu_block_fix_custom_menus()
- menu_block_update_7202 in ./
menu_block.install - Add missing custom menus to active menus list.
File
- ./
menu_block.install, line 165 - Provides install, upgrade and un-install functions for menu_block.
Code
function menu_block_fix_custom_menus() {
// Make sure all custom menus are present in the active menus variable so that
// their items may appear in the active trail.
// @see menu_set_active_menu_names()
$active_menus = variable_get('menu_default_active_menus', array_keys(menu_list_system_menus()));
$update_variable = FALSE;
foreach (menu_get_names() as $menu_name) {
if (!in_array($menu_name, $active_menus) && strpos($menu_name, 'menu-') === 0) {
$active_menus[] = $menu_name;
$update_variable = TRUE;
}
}
if ($update_variable) {
variable_set('menu_default_active_menus', $active_menus);
}
// Clear the menu cache.
cache_clear_all(NULL, 'cache_menu');
}