Attached is a patch which implements the feature requested.

In my use of your module, I needed to force submenus to always be hidden.

The use case is such that, the current url path will render the submenu (due to your desire to have the module degrade successfully when javascript is not on), but this may not be desired. The current url (when used more than once) may (actually will) present the submenu with options which don't apply to the current page.

The best way to replicate this is to use the same url path in more than one of the main menu items (e.g. level 0 menu items).

Since the ul item is set to display:block, the items used are from the first occurrence of the matching main menu.

Here's a (shortened) example menu from my situation

Home (<front>)

Vendors (/vendors)
-- Find one (/search/node)
-- Login (/user/login)

Services (/vendors)
-- Hosting (/hosting)
-- Development (/development)

My /vendors page lists various urls related to both vendors and the services they provide. So, it makes sense to use this as the path for both main menus. I am aware I could split these up, but this is my structure.

What happens when the user clicks 'Services' is that it shows the submenu from 'Vendors' and you get
'Find one' and 'Login' as options where the intended submenu is 'Hosting' and 'Development'.

Given that I'm fully aware of what happens if Javascript is not on or unavailable, I would prefer to deal with this myself by providing successful sub-navigation within the page itself (which is exactly what I do). The use case above dictated the feature I've provided here. Hopefully, you agree and can integrate or find an alternative. The UI provided by your javascript implementation is the desired feature.

The attached patch provides a checkbox option, within the block settings, that will hide all submenus so that the above example does not happen - yet, with javascript enabled, you get the cool hover effects in a simple block.

Side note: Granted, this does turn your Dynamic 'Persistent' Menu <grin> into just Dynamic Menu (because nothing is persisting), but it seems like a good feature for situations such as mine, where I just want the cool mouseover feature and don't care about successful javascript degradation.

P.S. I'll be shooting a video about your module on my video site GotDrupal.com

CommentFileSizeAuthor
hide_submenu_01.patch2.67 KBmattman
always-hide-checkbox.png44.19 KBmattman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yrocq’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Active » Needs work

Thanks for your patch. It is an interesting feature but I'd like to integrate the new features in the 2.x branch. I keep this issue open so that I can remember to integrate it in the next version. If you had a little time to update this patch, it would be really appreciated :-).