function special_menu_itemsoverwrite_menu_item in Special menu items 6
Override of theme_menu_item() This function will add a class to separator and nolink <li> tags for easier styling Generate the HTML output for a menu item and submenu.
1 string reference to 'special_menu_itemsoverwrite_menu_item'
- special_menu_items_theme_registry_alter in ./
special_menu_items.module - Implementation of hook_theme_registry_alter() We replace theme_menu_item_link with our own function.
File
- ./
special_menu_items.module, line 65 - Module to enable placeholder or separator menu items.Placeholder is a menu item which is actually not a link. Something like this is useful with drop down menus where we want to have a parent link which is actually not linking to a page but which is…
Code
function special_menu_itemsoverwrite_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
$class = $menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf');
if (!empty($extra_class)) {
$class .= ' ' . $extra_class;
}
if ($in_active_trail) {
$class .= ' active-trail';
}
if (strpos($link, 'class="nolink"') !== FALSE) {
$class .= ' nolink-li';
}
if (strpos($link, 'class="separator"') !== FALSE) {
$class .= ' separator-li';
}
return '<li class="' . $class . '">' . $link . $menu . "</li>\n";
}