function context_condition_menu::condition_values in Context 7.3
Same name and namespace in other branches
- 6.3 plugins/context_condition_menu.inc \context_condition_menu::condition_values()
- 6 plugins/context_condition_menu.inc \context_condition_menu::condition_values()
Override of condition_values().
Overrides context_condition::condition_values
File
- plugins/
context_condition_menu.inc, line 10
Class
- context_condition_menu
- Expose menu items as a context condition.
Code
function condition_values() {
if (module_exists('menu')) {
$menus = menu_parent_options(menu_get_menus(), array(
'mlid' => 0,
));
$root_menus = array();
foreach ($menus as $key => $name) {
$id = explode(':', $key);
if ($id[1] == '0') {
$root_menus[$id[0]] = $name;
}
else {
$link = menu_link_load($id[1]);
$identifier = $link['link_path'];
$root_menu = $root_menus[$id[0]];
while (isset($menus[$root_menu][$identifier])) {
$identifier .= "'";
}
$menus[$root_menu][$identifier] = $name;
}
unset($menus[$key]);
}
array_unshift($menus, "-- " . t('None') . " --");
}
else {
$menus = array();
}
return $menus;
}