here is my menu class.
public function createShopAdminMenu()
{
$menu = $this->factory
->createItem('root')
->setChildrenAttribute('class', 'nav nav-pills')
;
$menu->addChild('Administration', ['route' => 'admin_dashboard', 'extras' => [ 'safe_label' => true ]]);
$products = $menu
->addChild('Products', ['route' => 'shop_admin_product', 'extras' => [ 'safe_label' => true ]])
->setDisplayChildren(false)
;
$products->addChild('Create', ['route' => 'shop_admin_product_form']);
return $menu;
}
And this is the template where I'm using the menu.
{{ knp_menu_render('shop_admin', { 'allow_safe_labels': true, 'currentClass': 'active', 'ancestorClass': 'active' }) }}
This is my routing table (as overview!).
And here is the screenshot how it look.
Then the bug / problem with the sub
route(s).
You can see... Both are active. That's bad. I dont know why. I think because the voter or something marks the /admin
as current because the others starts with /admin
.
Thanks in Advance for ideas!