Icons on Navigation Block
acouch - April 3, 2009 - 19:14
| Project: | iconify |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Great module. Thanks for making it.
I think it would be even better to have icons on the Navigation block. This would be possible by adding classes to the the list items with the following:
function phptemplate_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';
}
// Add unique identifier
static $item_id = 0;
$item_id += 1;
$id .= ' ' . 'menu-item-custom-id-' . $item_id;
// Add semi-unique class
$class .= ' ' . preg_replace("/[^a-zA-Z0-9]/", "", strip_tags($link));
return '<li class="'. $class .'" id="' . $id . '">'. $link . $menu ."</li>\n";
}Interested in a patch?
