Menu/DemoMenuBuilder.php
public function getMenu(Factory $factory, Helper $helper)
    {
        // Create root item
        $menu = $factory->createItem('root');

        // Add menu items
        $menu->addChild('Home', ['route' => 'imatic_view_demo_demo_index']);
        $componentIndex = $menu->addChild('Components', ['uri' => '#']);
        $helper->setDropdown($componentIndex);
        $componentIndex->addChild($factory->createItem('Basic', ['route' => 'imatic_view_demo_component_index']));
        $componentIndex->addChild($factory->createItem('Layout', ['route' => 'imatic_view_demo_component_layout']));
        $componentIndex->addChild($factory->createItem('Panel', ['route' => 'imatic_view_demo_component_panel']));
        $componentIndex->addChild($factory->createItem('Grid', ['route' => 'imatic_view_demo_component_grid']));
        $componentIndex->addChild($factory->createItem('Form', ['route' => 'imatic_view_demo_component_form']));
        $componentIndex->addChild($factory->createItem('Show', ['route' => 'imatic_view_demo_component_show']));
        $componentIndex->addChild($factory->createItem('Tabs', ['route' => 'imatic_view_demo_component_tabs']));
        $componentIndex->addChild($factory->createItem('Menu', ['route' => 'imatic_view_demo_component_menu']));
        $componentIndex->addChild($factory->createItem('Formatter', ['route' => 'imatic_view_demo_component_formatter']));

        $javaScriptIndex = $menu->addChild('JavaScript', ['uri' => '#']);
        $helper->setDropdown($javaScriptIndex);
        $javaScriptIndex->addChild('Ajaxify', ['route' => 'imatic_view_demo_ajaxify_index']);
        $javaScriptIndex->addChild('Toggle', ['route' => 'imatic_view_demo_toggle_index']);

        return $menu;
    }
public function getMenu(Factory $factory, Helper $helper)
    {
        // Create root item
        $menu = $factory->createItem('root');

        // Add menu items
        $menu->addChild('Home', ['route' => 'imatic_view_demo_demo_index']);
        $componentIndex = $menu->addChild('Components', ['uri' => '#']);
        $helper->setDropdown($componentIndex);
        $componentIndex->addChild($factory->createItem('Basic', ['route' => 'imatic_view_demo_component_index']));
        $componentIndex->addChild($factory->createItem('Layout', ['route' => 'imatic_view_demo_component_layout']));
        $componentIndex->addChild($factory->createItem('Panel', ['route' => 'imatic_view_demo_component_panel']));
        $componentIndex->addChild($factory->createItem('Grid', ['route' => 'imatic_view_demo_component_grid']));
        $componentIndex->addChild($factory->createItem('Form', ['route' => 'imatic_view_demo_component_form']));
        $componentIndex->addChild($factory->createItem('Show', ['route' => 'imatic_view_demo_component_show']));
        $componentIndex->addChild($factory->createItem('Tabs', ['route' => 'imatic_view_demo_component_tabs']));
        $componentIndex->addChild($factory->createItem('Menu', ['route' => 'imatic_view_demo_component_menu']));
        $componentIndex->addChild($factory->createItem('Formatter', ['route' => 'imatic_view_demo_component_formatter']));

        $javaScriptIndex = $menu->addChild('JavaScript', ['uri' => '#']);
        $helper->setDropdown($javaScriptIndex);
        $javaScriptIndex->addChild('Ajaxify', ['route' => 'imatic_view_demo_ajaxify_index']);
        $javaScriptIndex->addChild('Toggle', ['route' => 'imatic_view_demo_toggle_index']);

        return $menu;
    }
@param Factory $factory
@param Helper  $helper

@return \Knp\Menu\ItemInterface