示例#1
0
 /**
  * @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_.+$/']]]]));
     }
 }
示例#2
0
 public function testDefaultState()
 {
     $this->assertSame($this->factory, $this->event->getFactory());
     $this->assertSame($this->item, $this->event->getItem());
 }
示例#3
0
 /**
  * @return ItemInterface
  */
 public function create()
 {
     $this->eventDispatcher->dispatch(MenuBuilderEvents::BUILD, $event = new MenuBuilderEvent($this->factory, $this->factory->createItem($this->getName())));
     return $event->getItem();
 }