function _jump_menu_create_options in Better Jump Menus 6
Same name and namespace in other branches
- 8 jump_menu.module \_jump_menu_create_options()
- 7 jump_menu.module \_jump_menu_create_options()
Recursive menu to select option building.
1 call to _jump_menu_create_options()
- jump_menu in ./
jump_menu.module - Main constructor function.
File
- ./
jump_menu.module, line 62 - Make use of the CTools jump menu and grabs from an existing menu. See: modules/ctools/includes/jump-menu.inc NOTE: Menu items must be checked as "expanded" for traversing to work.
Code
function _jump_menu_create_options(&$t, &$m, &$d) {
foreach ($m as $item) {
// Set the option.
if ($item['link']['hidden'] == 0) {
// Kill non-viewable menu items.
// Add depth indicators to titles.
if ($d['current'] > 1) {
$title = ' ' . str_repeat('-', $d['current']) . ' ' . $item['link']['title'];
}
else {
$title = $item['link']['title'];
}
// Add targets.
// Allow for special menu item dummy items for grouping.
if (module_exists('special_menu_items') && $item['link']['page_callback'] == 'special_menu_items_dummy') {
// Create a dummy option using optgroups.
$t[t($title)] = array();
}
else {
// Create a normal option.
$t[url($item['link']['href'])] = t($title);
}
}
// Loop deeper if there is no max or we haven't reached it.
if ($item['below'] && ($d['max'] == 0 || $d['current'] < $d['max'])) {
$d['current']++;
// Drop current depth.
_jump_menu_create_options($t, $item['below'], $d);
}
}
$d['current']--;
// Raise current depth back up.
}