4

I'm trying to set up a menu layout which has two links to /biblio; one under "Researchers", and one under "Staff". This is for convenience, as if you are looking under "Staff", the "Researchers" submenu is closed, and the "Staff" submenu isn't available to unregistered users. The problem I'm running into is that although I can have two links in different parts of the menu, when looking at the page it will always try to open the menu to only one of them. This means that if you are looking under "Staff", and you go to publications, suddenly you're in what seems to be a different location of the site. Any suggestions for how I can fix this?

  • Any news on this? I have similar problem where only one submenu expands and I need expanded both. – Aleksander Belov Feb 13 '14 at 10:56
3

You can use the Multiple Node Menu module.

  • I think this is the answer, though the use case could possibly also involve drupal.org/project/special_menu_items – coderintherye Mar 10 '11 at 19:57
  • Hi! Thanks for the answer, but I'm looking to do something with a non-node path. I can add the items into the menu with no problem; the problem is making it display the right tree to the item... – Ricky Morse Mar 10 '11 at 20:09
1

The issue here is that you have one page, and two ways of getting to it. Suppose you went straight to /biblio on your site, from a bookmark or something. Drupal would have no idea if you intended to be "Staff" or a "Researcher".

In this situation, you might be able to do something like /staff/biblio and /researchers/biblio, which would be the same page, but this would enable Drupal to tell which version of the menu to display.

An alternative might be to say "if the user is logged in (or has a specific role), assume that he or she has used the 'staff' menu, and if not logged in, assume the 'researchers' menu".

  • Part of the problem is that biblio is provided by a module, so I can't really control that part of it. I did look at spoofing hook_menu() to provide multiple paths, but there are complications with the way the module is programmed. How would you implement your second suggestion (determining based on role)? That would work just fine for my purposes... – Ricky Morse Mar 11 '11 at 14:32
  • I think this answer is fairly good. You may want to look at using hook_menu_alter to modify the existing modules menu item to be in two places. – lordg Mar 25 '11 at 9:38
1

The real problem here is that Core is inconsistent when handling two menu items with the same path. It says one thing in the UI and does another in reality.

The result of which is that the menu link added most recently, the one with the highest menu link ID, is the one whose menu trail will be active.

If that's not your preference, delete your preferred duplicate menu item, and then re-add it. It will then have the highest ID number so when you land on the internal URL path, that menu item's trail will be active.

I don't believe there's a way to have have multiple trails active at the same time; you have to select one.

0

To have two different URLs that point to /biblio should be sufficient to create two path aliases that alias /biblio. The exact path aliases to use depend from the menu URLs.

  • 2
    I've tried that; the problem is that Drupal's menu system resolves all aliases before storing in the menu table, and after loading the page tries to guess where the item is in the menu by looking backwards... – Ricky Morse Mar 11 '11 at 22:15
0

The Menu Position module allows you to configure rules that apply to items placed in menus.

You can restrict the active menu item depending on the page, content type, language, taxonomy, or user role.

Using this, you'd create two Menu Position Rules within your menu, at different spots, and use them to set the active menu trail by the user role.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.