Hi

I have created a menu programmatically where each menu entry is related to a node, say there are three nodes:

title = 'level0'
nid = 555
path alias '555'

title = 'level1'
nid = 556
path alias '555/556'

title = 'level2'
nid = 557
path alias '555/556/557'

First menu entry is given the name: level1 and a path '555'

Second menu entry is given the name: level2 and a path '555/556'

Third menu entry is given the name: level3 and a path '555/556/557'

Now if I force each menu item to be expanded (when I create the menu) the menu block shows all the items and clicking on each displays the correct node.

level1 => node 555
level2 => node 556
level3 => node 557

The root menu entry (level1) is given a type of 115, and the others are 118 (plus the expanded flag).

However under normal conditions I only want to force the level1 to be automatically expanded (so it displays level2) and leave level3 (and anything deeper) collapsed, so it looks like this:

level1
level2

Now clicking on level2 displays node 556 (which is what I want) but the menu doesn't get expanded to display the level3 entry, and it needs to.

I believe the menu is being constructed correctly -- because it's fine when I force every item to be expanded and all the nodes are displayed correctly. So what do I need to do to force the expansion of the level2 menu item when it's selected?

I have spent a long time looking at menu-related issues and tried various things but nothing seems to deal with this directly or provide the necessary hints.

Steve

Comments

SteveTurnbull-1’s picture

The menu illustrations should look like this:

level1 => node 555
---level2 => node 556
------level3 => node 557

and

level1
---level2