0

I'm customizing the main menu using the Menu Block Module. I need to set a class for all li elements that has children regardless of level. I might need to add a span inside the a-tags as well. Is it possible to do this in the template.php or do I need to alter module files. I would preffere not to edit module files if possible.

Like:

<li class="expanded menu-mlid-871 has-children">
   <a href="...">Menu item name<span class="test"></span></a>
   <ul> <!-- (children items) --> <ul>
</li>

Is this doable with some:

function theme_menu_link(array $variables) { ...?... }

[edit]

Menu items with no children has the class="leaf". It should be possible to style the menu items li (has children) and then cancel the rule-set for the class li.leaf (has no children). The span can be added by using some li::after rule-set and removed with eg li.leaf::after {display:none;}

In this way it can be solved with CSS only. The problem is I need to use the <span class="test"></span> for a click event. So at least I need a real span inside the li a witch is not a "leaf".

Anyone who can help me with a theme functions for this?

1 Answer 1

0

Menu items with no children has the class="leaf". It is possible to style the menu items li (has children) and then cancel the rule-set for the class li.leaf (has no children).

A span can be added to all li's (set to display:none for leafs). How do I insert a <span> </span> tag inside the <a> </a> tag on my main menu

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.