ZF-7003: Navigation_Menu view helper html render improvement
Description
Hi, The navigation menu render helper, render html (ul, li and a) elements for example:
Link A
Link B
The renderer use the navigation page CSS class for element A, If we wana styling specific LI element with current configuration its very hard and must use CSS selectors etc.., It can be more easy to achieve if the navigation page CSS class styles the LI element not the A element like below
Link A
Link B
Now its easy to refer to both li and a.
Thanks
Comments
Posted by Robin Skoglund (robinsk) on 2009-06-13T04:26:48.000+0000
So you want a boolean switch in the menu helper for enabling this behaviour (using page CSS classes for LI instead of A)?
Posted by Mina R Waheeb (syncer) on 2009-06-13T10:29:16.000+0000
There is no need to style the A element because you can easy style it by CSS2 selectors (.class a) which currently implement in all the browsers but for backward compatible it would be suitable.
Posted by Robin Skoglund (robinsk) on 2009-10-20T02:25:19.000+0000
I agree.
The only thing that bites me is that I remember there was a reason for styling the A (instead of the LI). That is to say, there was a reason for that design choice, but I can't remember it right now. Will look further into it.
Posted by Wouter E. M. Berben (software@wemb.info) on 2009-10-20T02:59:59.000+0000
If you are wondering: I've modified the Zend_View_Helper_Navigation_Menu so it sets the class on the list item element and not the anchor element. It works and doesn't show any defects. For me this isn't any issue, but I would prefer to see the sollution in the original Framework. Thanks.
I believe the design reason is absolute since CSS2.
Posted by Wouter E. M. Berben (software@wemb.info) on 2009-10-20T03:17:44.000+0000
I mean absolete, not absolute :) Sorry for that.
Posted by Stéphane (stephane) on 2009-12-05T03:16:47.000+0000
This would be a nice improvement indeed. Did you have the time to look into it Robin?
Posted by Peter Slivka (svestka) on 2010-01-25T06:23:49.000+0000
I've created a small patch for this. Maybe it helps someone, it just use the same class names for LI elements as for the anchors.
Posted by Stéphane (stephane) on 2010-05-12T10:21:48.000+0000
Robin, would it be possible to integrate the patch from Peter? Regarding CSS, we are able to target a child element from a given element:
but not the opposite. At least, would it be possible to have an update on this issue?
Posted by Kai Uwe (kaiuwe) on 2011-04-06T09:05:02.000+0000
For backward compatibility in the HTML output we need (for the moment) a boolean switch. In Version 2 we remove the switch and set the class to the list element. We also improve the whole rendering for all helpers and all elements (ul, li, a, span, …).
Posted by Kai Uwe (kaiuwe) on 2011-06-07T16:22:26.000+0000
I have written some tests and the implementation. For the current major release, there will be a boolean switch.
Posted by Frank Brückner (frosch) on 2012-07-06T10:15:20.000+0000
Patch and unit tests added.
Posted by Rob Allen (rob) on 2012-11-07T21:27:39.000+0000
Applied patch to trunk (25112) and release-1.12 (25113)