I’ve put in Drupal Developer plugin Menu block and I’m very pleased with Drupal Developer outcome, however I might like to vary some courses in Drupal Developer construction.
That is what I get proper now:
<div class="content material"> <ul class="menu"> <li class="first final expanded"> <a category="energetic" href="http://instance.com">Information</a> <ul class="menu"> <li class="first final leaf"> <a category="energetic" href="http://instance.com">Check</a> </li> </ul> </li> </ul> </div>
..and that is what I would like:
<div class="content material"> <ul id="nav-list"> <li class="first final expanded has-submenu"> <a category="energetic" href="http://instance.com">Information</a> <ul class="sub-menu"> <li class="first final leaf"> <a category="energetic" href="http://instance.com">Check</a> </li> </ul> </li> </ul> </div>
So I principally wish to..
- ..add/change/take away Drupal Developer
<ul>
‘s class and id attributes (stage particular, so not Drupal Developer identical for Drupal Developer major/secondary<ul>
). - ..add a
has-submenu
class to an<li>
if it accommodates one other submenu.
What I’ve tried:
As defined in Menu Block’s documentation, a hook perform hook_menu_block_tree_alter()
may be carried out. To start out ‘someplace, I attempted implementing this in template.php with none success (however does not even get referred to as):
perform THEME_menu_block_tree_alter(&$tree, &$config) { foreach ($tree as $key => &$worth) { if ($tree[$key]['link']['access'] && !$tree[$key]['link']['hidden']) { $gadgets[] = $tree[$key]; } } $num_items = depend($gadgets); foreach ($gadgets as $i => &$information) { $class = array(); if ($information['link']['has_children']) { $class[] = 'has-submenu'; } $component['#attributes']['class'] = $class; } }
Any assist could be a lot appreciated as I do not actually have deep understanding of how and the place to implement this hook perform. Additionally my impression is, that some extra detailed documentation is lacking for this particular hook perform..