Hey!
On a D7-page I have a menu at the top that only contains the root elements of the specified menu. The other items of this menu - depending on the chosen topmenu-link - will be displayed on the left site via menu_blocks module. No problem so far.
But I need to style the menu on the left depending on the associated root-menu-item. So I need to have someting like the mid of the active menu root item in the menu's classes. Is there any way to do this?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Zuzuesque’s picture

Hey,
I have the very same problem. For a theme I am working on I have a horizontal main menu and a vertical submenu. Depending on what item was selected in the main menu I want to set the submenu's background color - so I would need the name or id of the parent element added to the child's class list.

The stange thing is - it seems a menu item does already give out the parent-mlid - sadly it is always 0, no matter what the mlid of the parent element is. I am not sure but I feel this is a bug. Some help on this issue would be greatly appreciated.

JustMagicMaria’s picture

Category: support » bug

I could really use this too. Since the parent-mlid is always 0, I'm switching the category of this issue to bug report.

Zuzuesque’s picture

Checking other issues, it seems to be the same bug someone already made a patch for: http://drupal.org/node/1209520

geek-merlin’s picture

geek-merlin’s picture

Title: Parent-menu-ID in classes » Make Active-Parent-menu-ID available as css class for fixed level menus
Version: 7.x-2.1 » 7.x-2.x-dev
Status: Active » Needs review
FileSize
2.57 KB

yay, and here's the fix to make our themers happy:

the menu wrapper now gets a css class like 'active-parent-mlid-1234'.
i intentionally named the class different than the 'parent-mlid-1234' class because this is for menus with fixed parent, and this is about a menu with fixed level.

(coders, i'm not too proud passing the new info in the config array but it seems the only way without creating globals or making bigger data model changes.)

JohnAlbin’s picture

Category: bug » feature
Status: Needs review » Closed (won't fix)

THis is a feature request not a bug. And I'm not terribly excited about adding it. It's an edge case.