Issue Type: Bug Created: 2009-06-10T15:16:51.000+0000 Last Updated: 2009-10-18T13:26:23.000+0000 Status: Closed Fix version(s): Reporter: Alex Farcas (ghola) Assignee: Robin Skoglund (robinsk) Tags: - Zend_Navigation
Related issues: Attachments:
Assume you have a menu with the following tree like structure (as defined in some xml or array): * A * B ** D * C
So there are 3 root entries and entry B has D as a child entry. If the currently active menu entry is B, the following piece of code = $this->navigation()->menu()->renderSubMenu(); ?> will display menu entry D If the currently active menu entry is A or C, the same code will display menu entries A, B and C ( the same as you would use = $this->navigation()->menu()->setMaxDepth( 0 ); ?> )
In the second situation, there should be nothing displayed, because menu entries A and C don't have any child entries. This makes the navigation control unusable for displaying multiple menu levels separately.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-06-10T15:20:25.000+0000
I guess you should just use renderMenu().
Posted by Alex Farcas (ghola) on 2009-06-10T15:30:08.000+0000
Corrected some wiki markup
Posted by Alex Farcas (ghola) on 2009-06-10T15:33:40.000+0000
renderMenu() does the same thing. To obtain the same effect i would need to use: $this->navigation()->menu()->renderMenu( null, array( 'minDepth' => 0, 'maxDepth' => null,'renderParents' => false, 'onlyActiveBranch' => true ) ); ?> and this behaves in the same way renderSubMenu does (which may be normal because renderSubMenu calls renderMenu with these settings....as stated in the documentation).
So the fault is not with renderSubMenu only.
Posted by Alex Farcas (ghola) on 2009-06-10T15:39:43.000+0000
To complete the previous comment:
The issue was described as a renderSubMenu issue, because it refers to the type of functionality renderSubMenu represents, namely being able to render subentries of the currently active branch for a certain depth level (or an interval ... using minDepth and maxDepth). This makes possible independent renderization for each level in the menu (assume you level 1 menu is horizontal at the top of the apge, and your level 2 is vertical at the left of the page)
Posted by bullfrogblues (gerardroche) on 2009-10-16T02:53:08.000+0000
possibly related http://framework.zend.com/issues/browse/ZF-6673
Posted by Robin Skoglund (robinsk) on 2009-10-16T13:41:22.000+0000
This is not a bug. It's the intended functionality.
Posted by bullfrogblues (gerardroche) on 2009-10-17T07:47:44.000+0000
I don't understand why it is intended behaviour, "'renderParents' => false", yet it renders the parents.
Posted by Robin Skoglund (robinsk) on 2009-10-17T13:27:08.000+0000
In the second case, A, B, and C are rendered because they are siblings of the active page.
Posted by bullfrogblues (gerardroche) on 2009-10-18T10:29:40.000+0000
That's incorrect, they are parents of the menu (submenu) you are displaying which has no entries.
i.e. You are rendering a menu with no items which has parents A, B & C and you declare that the parents, A, B & C not be rendered "'renderParents' => false".
Posted by Robin Skoglund (robinsk) on 2009-10-18T11:29:24.000+0000
A, B, and C are on the same level, level 0, thus they will all be rendered as siblings if one of them are active.
Posted by bullfrogblues (gerardroche) on 2009-10-18T12:04:12.000+0000
I disagree, while this might be intended behaviour it's incorrect behaviour because they are not siblings they are parents of empty menu entries (the submenu). It's very clear when you display the menu, i.e. create the menu above as one main menu with just A,B & C shown, then create a submenu which only displays the child entries of A,B &C (in a sidebar menu, the submenu of A, B or C (the parent entries)).
When you select B D will shown in the sidebar, but when select A or C A,B&C are shown when none should be because A,B & C are the parents, why should they be repeated if you declare render no parents?
If you display a main menu with a submenu and render no parents no menu item should be displayed twice.
Posted by Robin Skoglund (robinsk) on 2009-10-18T12:21:47.000+0000
Do you know what 'sibling' means?
<pre class="highlight"> [root] / | \ A B C | D
A, B and C are on the same level, they are siblings. The renderParents flag has nothing to do with it.
FYI, there have been talk about adding a renderSiblings flag. Unless someone else steps up, it probably won't be in there before zf 2.0
Posted by bullfrogblues (gerardroche) on 2009-10-18T13:26:23.000+0000
Yes A, B & C are siblings. B is a parent of D and D is a child of B. A & C have no children.
But assume A is active.
What should renderSubmenu() (the children) of A display?
$this->navigation()>menu()>renderMenu( null, array( 'minDepth' => 0, 'maxDepth' => null,'renderParents' => false, 'onlyActiveBranch' => true ) );
None. A has no children. A, B & C are not siblings of _none but A is the *parent* of the _none in this case.
Have you found an issue?
See the Overview section for more details.