menu_get_active_trail() not working correctly?

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by bstoppel on August 13, 2009 at 3:20pm

Hi All.

I just joined this group. I've encountered a problem with menu_get_active_trail(). I may be going about what I am trying to do incorrectly. I'll take any mid-course corrections that you all have to offer.

First the problem.

I have a nested menu structure that looks something like this:

Home
- Visit
-- Tickets & Admission
-- Calendar of Events
-- Directions & Parking
-- Plan an Event
-- Dining & Shopping
-- Hotel Packages
- Get Involved
- Education & Activities
- Multimedia
- Research & Collections
- Science & Exhibits

I am print_r()ing menu_get_active_trail() when I am on a tertiary nested page like Tickets & Admission. The array that I am getting back from menu_get_active_trail() doesn't contain an array element for Visit, which I expected it to. Basically it is showing Home > Tickets & Admission and not Home > Visit > Tickets & Admission.

I don't see any flags or options that I should set. I am not sure what is wrong. Ideas?

Second, what I am trying to do.

When a user is on one of the tertiary page, I would like the page to display all of its sibling links. So when you click on Tickets & Admission, you should see menu items for

-- Tickets & Admission
-- Calendar of Events
-- Directions & Parking
-- Plan an Event
-- Dining & Shopping
-- Hotel Packages

Is there an easy way to do this? I am using the menu subtree project.

Many thanks in advance.

Comments

same question

Posted by markabur on September 25, 2009 at 10:45pm

i'm having trouble getting context module's "set context by active menu trail" to work... i'm trying basically the same thing as the OP here:

http://drupal.org/node/463898

and have traced the problem to menu_get_active_trail() behaving as described above -- the active trail for everything is coming back as > node/[nid], even though isn't even in any of my menus, and node/[nid] is nested two or three levels down in the primary links.

what i'm expecting is that any menu item that ends up with the "active-trail" class would be returned by menu_get_active_trail(), but that's not happening..

Menu

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /