Hi,
We use Dynamic Persistent Menu together with the Menu Trails Module (http://drupal.org/project/menutrails)
I am expecting a problem concerning the active trail of a node wich is not in the menu itself (thats we use Menutrails)
On that page i see this problem:
The normal/standard drupal menu block shows the following code:
<ul class="menu"><li class="leaf first active-trail"><a href="/de/content/parentnode" title="parentnode">Parentnode</a></li>
<li class="collapsed"><a href="/de/node/7" title="Node7">Node7</a></li>
<li class="collapsed last"><a href="/de/node/6" title="Node6">Node6</a></li>
</ul>
That tells me everything with the configuration of Menu Trails is ok (otherwise the parent of the current node wouldn't be set to "active-trail")
But the Code of DPM doesn't show the Active Trail:
<ul class="dynamic-persistent-menu-menu"><li class=" dynamic-persistent-menu-menu-item" id="dynamic-persistent-menu-menu1686"><a href="/de/content/parentnode" title="parentnode">parentnode</a></li>
<li class=" dynamic-persistent-menu-menu-item" id="dynamic-persistent-menu-menu923"><a href="/de/node/7" title="Node7">Node7</a></li>
<li class=" dynamic-persistent-menu-menu-item" id="dynamic-persistent-menu-menu918"><a href="/de/node/6" title="Node6">Node6</a></li>
</ul><ul class="block dynamic-persistent-menu-sub-menu" id="dynamic-persistent-menu-sub-menu923" style="display:none"><li class=" dynamic-persistent-menu-sub-menu-item" id="dynamic-persistent-menu-sub-menu-item924"><a href="/de/node/8" title="Node8">Node8</a></li>
</ul>
Am i missing something or is this a bug of DPM?
Best Regards,
Sandro
Comments
Comment #1
pandersb commentedsubscribing
Comment #2
pandersb commentedI was able to fix this, if not in an elegant way, but I modified theme_dynamic_persistent_menu by grabbing some code from menutrails module (taken from function menutrails_get_breadcrumbs()).
The function theme_dynamic_persistent_menu basically iterates through the menu_set_active_trail. And, when you're on a node that is not actually under a parent menu in Drupal's menu system, menu_set_active_trail will not give you anything you can use. So, after figuring out how menutrail determines the node's menu trail, I cobbled them together and it works for me.
Comment #3
yrocq commentedI rewrote the menu loading code. It should work better now. Could you test it? (use the 6.x-1.x-dev snpashot).
Comment #4
yrocq commentedFixed in 6.x-1.5
Comment #6
Sinan Erdem commentedIs it implemented on version 2? I am using 2.0 alpha 3 and cannot see any active-trail class on the items that have children.
Comment #7
dankh commentedSorry for reopening this but still doesn't work for me. My links doesn't follow any particular scheme so active-trail don't work, but with 2 line jquery fix I made it work. Please check the patch.
Comment #8
dankh commentedI found a bug in my first patch here is the update one. I also wanted to explain what my patch does :
- if current menu is active : adds class "dynamic-persistent-menu-active" to the li element
- if sub menu is active : adds class "dynamic-persistent-menu-active" to the top menu li element
This way we can have active trail even if the menu system doesn't detect the parent-children relationship between the menu items.
Comment #9
yrocq commentedetcetera9: It isn't fixed in version 2 yet. I want to fix it definitively in 1.x before porting it.
dankh : I don't think that we should do that on the client side. I made some changes in the PHP code that should fix the problem. Could you test it ? ( branch 6.x-1.x-dev).
Thanks !
Comment #12
alberto56 commentedI took over this project from yrocq. I'll wait for someone to respond to yrocq's comment at #9 before pursuing.