function quickbar_menu_navigation_links in Quickbar 7
Same name and namespace in other branches
- 6 quickbar.module \quickbar_menu_navigation_links()
- 7.2 quickbar.module \quickbar_menu_navigation_links()
Generate a links array from a menu tree array.
1 call to quickbar_menu_navigation_links()
- quickbar_menu_tree_links in ./
quickbar.module - Build a hierarchy of $links arrays suitable for theme_links() from a menu tree.
File
- ./
quickbar.module, line 305
Code
function quickbar_menu_navigation_links($tree, $admin_only = FALSE) {
$links = array();
foreach ($tree as $item) {
if (!$item['link']['hidden']) {
$class = '';
$id = str_replace('/', '-', $item['link']['href']);
$id = str_replace('<front>', 'front', $id);
$l = $item['link']['localized_options'];
$l['href'] = $item['link']['href'];
$l['title'] = "<span class='icon'></span>" . $item['link']['title'];
$l['attributes'] = array(
'id' => 'quickbar-link-' . $id,
);
$l['html'] = TRUE;
// If menu item container module is enabled don't go to any url when
// clicked.
if (module_exists('menu_item_container')) {
global $base_url;
if (strpos($l['href'], 'menu-item-container') !== FALSE) {
$l['href'] = $base_url . '/' . drupal_get_path_alias(str_replace('%2F', '/', current_path())) . '#';
if (drupal_is_front_page()) {
$l['href'] = $base_url . '#';
}
}
}
$class = ' path-' . $id;
if (quickbar_in_active_trail($item['link']['href'])) {
$class .= ' active-trail';
}
// Keyed with the unique mlid to generate classes in theme_links().
$links['menu-' . $item['link']['mlid'] . $class] = $l;
}
}
return $links;
}