It seems like megamenu strips out all the active-trail classes in my menus. It leaves an "active" class, but only on the top-level parent "li" tag, and on the leaf-node "a" tag. So in a three-tier menu, the middle tier has no active attributes to target my css to.
A regular (non-megamenu) version of the same menu gets all its active-trail classes properly inserted by core. What is megamenu doing to remove these?
<ul id="megamenu-menu-portfolio" class="megamenu-menu stacking megamenu-skin-myskin">
<li id="megamenu-mlid-875" class="megamenu-parent megamenu-parent-0 odd half-1 leaf-0 first menu-875 first last active">
<h2 class="megamenu-parent-title">
<a href="/portfolio/work">Portfolio</a>
</h2>
<ul class="megamenu-bin megamenu-slots-stacking" style="top: -9000px; left: 0px; width: 200px;">
<li id="megamenu-mlid-876" class="megamenu-slot megamenu-slot-0 odd half-1 leaf-0 first first">
<h3 class="megamenu-slot-title">
<a href="/portfolio/work">Work</a>
</h3>
<ul class="megamenu-items ">
<li id="megamenu-mlid-935" class="megamenu-item megamenu-item-0 odd half-1 leaf-0 first first">
<a class="active" href="/portfolio/work/hp">Company 1</a>
</li>
<li id="megamenu-mlid-939" class="megamenu-item megamenu-item-1 even half-1 leaf-1 ">
<li id="megamenu-mlid-941" class="megamenu-item megamenu-item-2 odd half-1 leaf-2 ">
<li id="megamenu-mlid-945" class="megamenu-item megamenu-item-3 even half-1 leaf-3 ">
<li id="megamenu-mlid-946" class="megamenu-item megamenu-item-4 odd half-2 leaf-4 ">
<li id="megamenu-mlid-947" class="megamenu-item megamenu-item-5 even half-2 leaf-5 ">
<li id="megamenu-mlid-943" class="megamenu-item megamenu-item-6 odd half-2 leaf-6 last last">
</ul>
</li>
<li id="megamenu-mlid-880" class="megamenu-slot megamenu-slot-1 even half-2 leaf-1 last last">
</ul>
</li>
</ul>
Comments
Comment #1
squeakyferret_sf commentedI think I found my answer. I don't know how to do a patch, so here are the changed functions below. Both are in megamenus.utilities.inc:
In the original, menu_tree_page_data() is used to pull a menu array that contains active_trail info, and then it is never referenced again. My assumption is the author intended to use that active trail data. The new version references that active trail information, inserting it into the $menutree array. _megamenu_active_classes() needed modification as well to properly reference the 'below' array key.
This works, and I get active trails now in all my menus.
Comment #2
zd370 commentedI basically ended up doing what you have done. The megamenu was not keeping an active trail for pages that are beyond tertiary level.
Comment #3
jumoke commentedGreat fix, thanks all. This needs to be committed to head.
Comment #4
thekatic commentedFirst to thank you for this very useful patch, but I had to extend it a bit.
Without this extension, "Page not found" will through you an error.
Maybe this is not the best way to do it, but it works.
Comment #6
ram4nd commented