1
votes

I have the following menu structure. Node1 and Node2 are top level links. NodeA and NodeB are children of Node2.

-Node1
-Node2
--NodeA
--NodeB

When your on Node2, NodeA or NodeB a secondary level menu is shown via the menu block module. This secondary menu contains NodeA and NodeB.

So far this is working fine. However I also need to add a top level link to NodeB.

-Node1
-Node2
-NodeB
--NodeA
--NodeB

If I do this, then once I am on NodeB's page I lose the secondary level menu. Ive tried playing with the settings of the menu and the menu block and setting links to expanded but it doenst change anything.

How can I keep the secondary level menu visible even if the node also has a top level link?

1
do you get the html of secondary links when you are on NodeB, if yes then you can just write some js to display the secondary links - Viswanath Polaki
I dont want to use JS for this. This would make the page jump around unecessarily. - Evanss
ok, you can render the menu after altering the menu links as you like with the help of drupal_render function. - Viswanath Polaki
Can you list the menu item ids, names and link paths, since I have created similar kind of menu and its showing expanded when I click on NodeB link - Viswanath Polaki
Have you considered selecting Starting level to "1st level (primary)" and Maximum depth to "Unlimited". - Viswanath Polaki

1 Answers

0
votes

I believe that the issue is that NodeB as a top level link also has the same alias as the NodeB in the submenu.

In the NodeB top level link try setting the URL to the absolute URL.

If you do it this way the Drupal menu system won't be confused by having two "equal" menu items.

Edit

You also can try to use the tokens module (I found one specific to what you need: https://www.drupal.org/project/menu_token). It appears to have issues with using the site-url token. It appears to have a workaround that you can try.

However this does not fix the problem with updating the alias. This is more difficult as you would need to use hook_node_update to update the menu links that you need.

Perhaps a combination of having an alternative alias called whatever and using a 301 redirect to the node/1234 could work.

Edit 2

I remembered now that perhaps you could also use the Rules module to take care of updating the aliases.