function menutrails_item_link in Menu TrailsMenu Trails 5
This is a substitute function for menu_item_link()
The important difference is that this will pick up the $active bit from the function above, and assign the "active" class to the link if it is present.
1 call to menutrails_item_link()
- menutrails_primary_links in ./
menutrails.module - This is a substitute function for menu_primary_links()
File
- ./
menutrails.module, line 255 - Menutrails allows the assigment of "trails" which will keep menu items active for individual node views.
Code
function menutrails_item_link($mid, $theme = TRUE, $active = FALSE) {
$item = menu_get_item($mid);
$link_item = $item;
$link = '';
while ($link_item['type'] & MENU_LINKS_TO_PARENT) {
$link_item = menu_get_item($link_item['pid']);
}
if ($theme) {
$link = theme('menu_item_link', $item, $link_item);
}
else {
$link = array(
'title' => $item['title'],
'href' => $link_item['path'],
'attributes' => !empty($item['description']) ? array(
'title' => $item['description'],
) : array(),
);
if ($active) {
$link['attributes']['class'] = 'active';
}
}
$link['mid'] = $mid;
return $link;
}