I am using Twitter Bootstrap on a project and their navigation system is quite awesome. The issue is that I need Zend_Navigation to set the UL class on submenus and Im not able to achieve that.
I have a plugin that on postDispache do this:
$layout = Zend_Layout::getMVCInstance();
$view = $layout->getView();////
$view->navigation( $this->getMenu() ); // load the menu container
$view->navigation()->menu()->setUlClass('nav'); // set UL class
my code for the navigation container is:
private function getMenu()
{
return new Zend_Navigation(array(
array(
'label' => 'DASHBOARD',
'id' => 'dashboard',
'route' => 'default_index_index',
'class' => 'nav',
'ulClass' => 'nav'
),
array(
'label' => 'POLICIES',
'id' => 'policies',
'route' => 'policies_policies_list',
'class' => 'active nav',
'ulClass' => 'nav',
'pages' => array(
array(
'label' => 'LIST',
'id' => 'policiesList',
'route' => 'policies_policies_add',
'class' => 'nav',
'ulClass' => 'nav'
)
)
)
));
}
The result code HTML is bellow:
<ul class="nav">
<li class="active">
<a id="menu-dashboard" class="nav" href="/">Dashboard</a>
</li>
<li>
<a id="menu-policies" class="active nav" href="/policies/list">Apólices</a>
<ul> <!-- we should have a class nav here too -->
<li>
<a id="menu-policiesList" class="nav" href="/policies/add">Listar</a>
</li>
</ul>
</li>
</ul>
I know that some duplicated class stuff in the array, but I tried everything, the result is that only the FIRST UL has a class, the submenus UL's haven't. Anyone knows how I can make Zend Navigation to set the class for UL on the submenus?
Cheers
Hugo