Is it possible to change the class(es) applied to the containing ul
element when the navigation is rendered, or exclude this element entirely and only list the li
and nested ul
elements for each navigation item?
Obviously I would like to avoid touching the core. I am using bootstrap which comes with its own requirements for classnames and I would like to avoid changing or extending the names used there.
public_nav_main
returns a Zend Navigation Menu helper object, so you can call some methods on what you get back rather than just echoing it immediately to change the output.
In this case, I think you want to call setUlClass
:
$menu = public_nav_main();
$menu->setUlClass('your-class');
echo $menu;
I went ahead and updated our documentation for public_nav_main
so it mentions that you can make changes like these and links to the Zend Framework documentation for the nav helper we're using.
That's great, thank you. And thanks for updating the documentation.
Is there a way to apply classes to the nested <ul>
elements too?