Link to home
Start Free TrialLog in
Avatar of jayelless
jayellessFlag for New Zealand

asked on

How do I programmatically expand a Drupal 6 navigation menu entry?

I have written a custom module that creates several top level entries in the navigation menu.  When a user selects one of these entries and navigates into it, the menu tree is expanded as selections are made.  However, selecting an entry that creates, views or edits a node, causes Drupal to redirect to "/node/xxx" or "/node/xxx/edit".  This results in the custom navigation menu tree collapsing, so that the user has to re-navigate it again to select another entry.

I can mark the menu entries as permanently expanded, but then the navigation menu is too busy as the trees show on all pages whether the user is using that function or not.

Are there any mechanisms to programmatically expand a menu item so that the relevant menu tree remains visible when the user has been re-directed away?

Thanks
Avatar of Thomas4019
Thomas4019
Flag of United States of America image

This modules not perfect, http://drupal.org/project/dhtml_menu, but might help.
Avatar of jayelless

ASKER

Thanks for pointing out that module.  It looks as though it may do some of what I am wanting, but is not the approach I was hoping to be able to take.  For performance reasons, I am trying to keep the amount of javascript deployed with each page to a minimum.

I am hoping that someone might know of some variables that can be set programmatically that will cause the Drupal rendering routines to expand a particular menu item.  When the item is selected via normal navigation, Drupal knows to expand it, so there should be a setting somewhere that controls this behaviour.

Regards
ASKER CERTIFIED SOLUTION
Avatar of TheChemic
TheChemic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the suggestion.  It is an approach I have not yet considered, but it seems to be an approach that fits with my objectives, so I will explore this idea to find a solution to my problem.

Regards,
Maybe my question was too difficult or not well expressed.