function context_condition_menu::condition_values in Context 6.3
Same name and namespace in other branches
- 6 plugins/context_condition_menu.inc \context_condition_menu::condition_values()
- 7.3 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() {
$menu_names = variable_get('context_condition_menu_selections', menu_get_menus());
$menus = menu_parent_options(array_reverse($menu_names), NULL);
$root_menus = array();
foreach ($menus as $key => $name) {
$id = explode(':', $key);
if ($id[1] == '0') {
$root_menus[$id[0]] = check_plain($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') . " --");
return $menus;
}