1

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!).

Routes

And here is the screenshot how it look.

enter image description here

Then the bug / problem with the subroute(s).

enter image description here

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!

Patrick
  • 829
  • 2
  • 13
  • 34
  • 1
    You are probably right. I guess, knpmenu believes that Products is a sub-page of Administration because of the routing. A simple fix would be to give your dashboard another route, such as `/admin/dashboard`. – Emanuel Oster Aug 10 '16 at 07:36

0 Answers0