Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Conflicts with http://drupal.org/project/special_menu_items
When there are items with a "nolink" path (simple containers) and they are not expanded by default,
DHTML Menu may display warnings:
warning: Invalid argument supplied for foreach() in /XXXX/sites/all/modules/dhtml_menu/dhtml_menu.module on line 175.
Also DHTML Menu continues acting on a menu even if disabled in settings.
Comment | File | Size | Author |
---|---|---|---|
#3 | dhtml_menu-508252.patch | 897 bytes | raphaelhuefner |
Comments
Comment #1
bwinett CreditAttribution: bwinett commentedHas anyone figured out how to fix this?
Comment #2
anrikun CreditAttribution: anrikun commentedYou may try http://drupal.org/project/menu_firstchild
It supports DHTML Menu.
Comment #3
raphaelhuefner CreditAttribution: raphaelhuefner commentedI worked on this issue because I had to "scratch my employer's itch" ...
To get rid of the
warning: Invalid argument supplied for foreach() in /home/raphael/projects/vtrunk/sites/all/modules/dhtml_menu/dhtml_menu.module on line 175.
, the "Expanded"-checkbox of all the "nolink"-items should get switched on. But that is not the whole story ... I needed to make a patch, also, which I'm going to describe next:The JavaScript in dhtml_menu.js tries to attach
toggleMenu()
(the collapse/expand-behavior) on the appropriate<a>
-tag, but with the "nolink"-item of http://drupal.org/project/special_menu_items it should better do this to a<span class="nolink">
-tag. So I augmented the jQuery-Selector from being'a:first'
to'a:first, span.nolink:first'
, but in "nolink"-items, this will still search for an<a>
-tag, even among deeper descendants, which might be a leaf menu item, for instance, which should not toggle anything.So I additionally changed the
.find(selector)
-call into a.children().filter(selector)
chain, in order to assure only direct descendant<a>
-tags get thetoggleMenu()
-behavior.Furthermore I added a means of the two modules communicating about the actual HTML-code being used to mark "nolink"-items, simply by querying
Drupal.settings.specialMenuItems.nolinkSelector
on this end. As long as this variable is not set, there is a fallback, of course. I still have to file an issue with http://drupal.org/project/special_menu_items to get this variable set in the first place. I will crosslink the two issues as soon as I know the other issue number.By the way, #585984: Menu item with 'no' path might be a duplicate of this issue here.
Comment #4
raphaelhuefner CreditAttribution: raphaelhuefner commentedThe corresponding issue over at http://drupal.org/project/special_menu_items is #661166: Make inter-operable with dhtml_menu , which will set the JavaScript variable
Drupal.settings.specialMenuItems.nolinkSelector
.Comment #5
srobert72 CreditAttribution: srobert72 commentedSame conflict with Admin module. DHTML Menu + Admin modules give me this error :
I use :
dhtml_menu 6.x-3.x-dev (2009-Dec-07)
admin 6.x-2.0-beta2 (2010-Feb-24)
Comment #6
adrianmak CreditAttribution: adrianmak commented#2: the menu_firstchild module link the parent link to it's first menu child that is not my desire. On the other hand, special menu items is what I want to , ie no link on the parent item.
Comment #7
anrikun CreditAttribution: anrikun commented#6: But if you use menu_firstchild with dhtml_menu, you might get what you need as the link on the parent item will only expand/collapse children.
Comment #8
adrianmak CreditAttribution: adrianmak commented#7: I tried menu_firstchild with dhtml module, I added < firstchild > on parent menu item path , but it still link to first child path while clicking the parent menu item
Comment #9
anrikun CreditAttribution: anrikun commentedYes the link is still here but dhtml_menu should override it with the expand/collapse effect.
Comment #10
adrianmak CreditAttribution: adrianmak commentedYes but the parent link still clickable even though the child items are expanded.
Comment #11
AdrianB CreditAttribution: AdrianB commentedSubscribing.
Comment #12
manuel.adanIn the meantime, special menu items v. 6.x-1.4 runs ok with dhtml_menu 6.x-3.5
Comment #13
jasondecamp CreditAttribution: jasondecamp commentedTried Patch from #3 (raphaelhuefner). Still get annoying error when links are not set to be expanded by default. Would be nice to fix this. Other than that, the patch appears to work as long as you apply the patches to both DHTML and Special_Menu_Items.
Thanks Raphael
Comment #14
geerlingguy CreditAttribution: geerlingguy commentedSubscribe.
Comment #15
beckyjohnson CreditAttribution: beckyjohnson commentedThis combo does not work for me. Special menu items 6.x-1.4 works with DHTML but it breaks Menu Block 6.x-2.3. Items that have special menu attributes won't expand.
Comment #16
beckyjohnson CreditAttribution: beckyjohnson commentedWhat version of DHTML did you test this patch on? I got the special menu items patch on ok but even with this patch as well, DHTML menu is still broken for me.
Comment #17
cburschkaA few changes to 6.x-3.x-dev were committed since the 3.5 release, notably including some sanity checks in the menu traversal (and compatibility with devel_themer, but that was such a specific fix it shouldn't have affected anything else). For example, the error message mentioned in #5 should no longer occur.
It'd be good to know if the conflicts remain in the 6.x-3.x-dev version.
Comment #18
Nico7 CreditAttribution: Nico7 commentedHi,
It's 2012 and the issue is still not resolved.
When the parent item is a nolink item, it is being shown as a link. If I click on the link, an error message occurs.
There shouldn't be a link at all.
Has anyone solved this?
Comment #19
El Bandito CreditAttribution: El Bandito commentedor found a workaround ?
Cheers
Comment #20
Nico7 CreditAttribution: Nico7 commentedHi El Bandito,
I solved the problem by going to the special menu items settings and replacing span with a href="#" (you have to put < and > around).
Now, special menu items works fine with DHTML module. I hope this works for you too.
Regards, Nico
Comment #21
El Bandito CreditAttribution: El Bandito commentedNico
I tried your suggestion, but my problem is that as soon as I enable this module my DHTML menus stop behaving properly - specifically clicking on a parent menu item causes several menus to expand, but not the one I actually clicked on. Very strange.
Hmmmmmn.
El B
Comment #22
vuilI closed the issue as Closed (outdated) because it is for unsupported 6.x version of Drupal.
Thank you for the contribution!