I know that using hook_menu_link I can add classes to the
<li> tags but I need to add a class to the
<a> tags within the
<li> of a menu. I've looked and can't find a way.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
You can do it from
hook_menu_link. You want to access the
Something like this
$element = $vars['element']; $element['#localized_options']['attributes']['class'] = 'your-class'; $output = l($link_text, $element['#href'], $element['#localized_options']);
Then return the $output in the
<li>. Be sure to account for
$vars['element']['#below'] if you have a sub-menu.