/** * @param MenuBuilderEvent $event */ public function onBuild(MenuBuilderEvent $event) { $item = $event->getItem(); if ($item->getName() === 'lug.admin.sidebar') { $item->addChild($event->getFactory()->createItem('locale', ['route' => 'lug_admin_locale_index', 'label' => 'lug.admin.menu.sidebar.locale', 'labelAttributes' => ['icon' => 'language'], 'extras' => ['routes' => [['pattern' => '/^lug_admin_locale_.+$/']]]])); } }
public function testDefaultState() { $this->assertSame($this->factory, $this->event->getFactory()); $this->assertSame($this->item, $this->event->getItem()); }
/** * @return ItemInterface */ public function create() { $this->eventDispatcher->dispatch(MenuBuilderEvents::BUILD, $event = new MenuBuilderEvent($this->factory, $this->factory->createItem($this->getName()))); return $event->getItem(); }