0

Im building my own menu tree for various reason, but one think i miss is the first / last classes. I dont find anything about it in the API and i do have drupal_attributes($element['#localized_options']['attributes']) set.

Where and how would the first/last classes be called?

my function in template.php goes something like this (taken direct from the API)

function theme_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']);
  return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}

1 Answer 1

0

Use Menu attributes module and give special ID or classes to your menu items. The module currently allows you to set the following attributes for each menu item:

Id
Name
Target
Rel
Class
Style
Accesskey
1
  • Thanks, i am using this module. I was hoping for a more automated way to "get back' per say, the default menu attributes like first/last.
    – petergus
    Jan 30, 2013 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.