/** * Generate the HTML output for a menu link and submenu. * * @param $variables * An associative array containing: * - element: Structured array data for a menu link. * * @return * A themed HTML string. * * @ingroup themeable * */ function basic_menu_link(array $variables) { $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { $sub_menu = drupal_render($element['#below']); } $output = l($element['#title'], $element['#href'], $element['#localized_options']); // Adding a class depending on the TITLE of the link (not constant) $element['#attributes']['class'][] = basic_id_safe($element['#title']); // Adding a class depending on the ID of the link (constant) if (isset($element['#original_link']['mlid']) && !empty($element['#original_link']['mlid'])) { $element['#attributes']['class'][] = 'mid-' . $element['#original_link']['mlid']; } return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n"; }
function basic_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'; } #New line added to get unique classes for each menu item $css_class = basic_id_safe(str_replace(' ', '_', strip_tags($link))); return '<li class="' . $class . ' ' . $css_class . '">' . $link . $menu . "</li>\n"; }