function _menu_breadcrumb_process_unknown_menus in Menu Breadcrumb 6
Same name and namespace in other branches
- 7 menu_breadcrumb.module \_menu_breadcrumb_process_unknown_menus()
Helper for _menu_breadcrumb_get_menus(). Determine whether each 'unknown' menu is genuinely new, or was previously aggregated by a pattern match.
Return value
Array of new/unknown menus.
1 call to _menu_breadcrumb_process_unknown_menus()
- _menu_breadcrumb_get_menus in ./
menu_breadcrumb.module - Get the menu selection configuration.
File
- ./
menu_breadcrumb.module, line 142 - The main file for the menu_breadcrumb module.
Code
function _menu_breadcrumb_process_unknown_menus($unknown_menu_names, $menus, $match_cache_old, $match_cache_rebuild) {
$new_menus = array();
// 'devel' and 'admin_menu' cause known issues, and should not
// be used for breadcrumbs.
$disabled_by_default = array(
'devel',
'admin_menu',
);
// consider hook here allowing modules to disable their menu
// by default.
foreach ($unknown_menu_names as $menu_name) {
$previously_matched = $match_cache_rebuild && array_key_exists($menu_name, $match_cache_old) && ($pattern = $match_cache_old[$menu_name]) && array_key_exists($pattern, $menus);
if ($previously_matched) {
// Use the known enabled/weight values for this pattern.
$enabled = $menus[$pattern]['enabled'];
$weight = $menus[$pattern]['weight'];
}
else {
// A genuinely unknown menu. Use default values.
$disable = in_array($menu_name, $disabled_by_default, TRUE);
$enabled = $disable ? FALSE : $menus['menu_breadcrumb_default_menu']['enabled'];
$weight = $disable ? count($menus) : $menus['menu_breadcrumb_default_menu']['weight'];
}
$new_menus[$menu_name] = array(
'enabled' => $enabled,
'weight' => $weight,
'type' => 'menu',
);
}
return $new_menus;
}