public function testMoveToPosition()
 {
     $menu = new MenuItem('root', new MenuFactory());
     $menu->addChild('c1');
     $menu->addChild('c2');
     $menu->addChild('c3');
     $menu->addChild('c4');
     $manipulator = new MenuManipulator();
     $manipulator->moveToPosition($menu['c1'], 2);
     $this->assertEquals(array('c2', 'c3', 'c1', 'c4'), array_keys($menu->getChildren()));
 }
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testReorderingWithWrongItemNames()
 {
     $factory = new MenuFactory();
     $menu = new MenuItem('root', $factory);
     $menu->addChild('c1');
     $menu->addChild('c2');
     $menu->reorderChildren(array('c1', 'c3'));
 }
예제 #3
0
 protected function setUp()
 {
     $factory = new MenuFactory();
     $this->menu = $factory->createItem('Root li', array('childrenAttributes' => array('class' => 'root')));
     $this->pt1 = $this->menu->addChild('Parent 1');
     $this->ch1 = $this->pt1->addChild('Child 1');
     $this->ch2 = $this->pt1->addChild('Child 2');
     // add the 3rd child via addChild with an object
     $this->ch3 = new MenuItem('Child 3', $factory);
     $this->pt1->addChild($this->ch3);
     $this->pt2 = $this->menu->addChild('Parent 2');
     $this->ch4 = $this->pt2->addChild('Child 4');
     $this->gc1 = $this->ch4->addChild('Grandchild 1');
 }
예제 #4
0
 public function testLabelTranslationDomainOverride()
 {
     $translatorProphecy = $this->prophesize('Symfony\\Component\\Translation\\TranslatorInterface');
     $translatorProphecy->trans('some-label', array(), 'my_local_domain', null)->willReturn('my-translation');
     $translatorProphecy->trans('some-other-label', array(), 'my_global_domain', null)->willReturn('my-other-translation');
     $this->translator = $translatorProphecy->reveal();
     $factory = new MenuFactory();
     $menu = new MenuItem('test-menu', $factory);
     $menu->setExtra('translation_domain', 'my_global_domain');
     $menu->addChild('some-label', array('uri' => '/whatever'))->setExtra('translation_domain', 'my_local_domain');
     $menu->addChild('some-other-label', array('uri' => '/whatever'));
     $html = $this->renderMenu($menu);
     $this->assertContains('my-translation', $html);
     $this->assertContains('my-other-translation', $html);
 }
예제 #5
0
파일: MenuItem.php 프로젝트: csbill/csbill
 /**
  * @param \Knp\Menu\ItemInterface|string|array $child
  * @param array                                $options
  *
  * @return \Knp\Menu\ItemInterface|string
  */
 public function addChild($child, array $options = [])
 {
     if (is_array($child) && empty($options)) {
         list($child, $options) = $child;
     }
     return parent::addChild($child, $options);
 }
예제 #6
0
 public function addMenuParts(MenuItem $menu)
 {
     $user = $this->securityContext->getToken()->getUser();
     if (is_object($user)) {
         $menu->addChild('Profile', array('route' => 'fos_user_profile_show', 'routeParameters' => array('id' => $user->getId())));
     }
 }
 public function testRenderOrderedList()
 {
     $menu = new MenuItem('test', new MenuFactory());
     $menu->addChild('About')->addChild('foobar');
     $rendered = '<ol><li class="first last"><span>About</span><ol class="menu_level_1"><li class="first last"><span>foobar</span></li></ol></li></ol>';
     $this->assertEquals($rendered, $this->createRenderer()->render($menu, array('template' => 'knp_menu_ordered.html.twig')));
 }
예제 #8
0
 /**
  * Add a child to the menu
  *
  * @param KnpMenu $menu
  * @param Menu    $item
  */
 protected function addChild(KnpMenu $menu, Menu $item)
 {
     $name = $item->getName() . $item->getId();
     $options = array();
     $options['label'] = ucfirst($item->getName());
     $options['extras'] = array('safe_label' => true);
     if (!$item instanceof MenuGroup) {
         if ($uri = $item->getLink()) {
             $options['uri'] = $uri;
         } elseif ($content = $item->getContent()) {
             $options['route'] = '_content';
             $slug = $content->getSlug();
             if (substr($slug, -6) == '/index') {
                 $slug = rtrim($slug, "index");
             }
             $options['routeParameters'] = ['slug' => $slug];
         }
     } else {
         $options['uri'] = '';
     }
     $menu->addChild($name, $options);
     if ($item->hasChildren()) {
         $menu[$name]->setChildrenAttribute('class', 'sub-nav');
         foreach ($item->getChildren() as $child) {
             $this->addChild($menu[$name], $child);
         }
     }
 }
예제 #9
0
 protected function addItem(MenuItem $root, $config)
 {
     foreach ($config['roles'] as $role) {
         if (!$this->security->isGranted($role)) {
             return null;
         }
     }
     $name = $config['label'];
     $label = isset($config['icon']) ? $config['icon'] . ' ' : ' ';
     $label .= "<span class='sidebar-title'>" . $config['label'] . "</span>";
     $label .= isset($config['items']) && count($config['items']) ? '<span class="caret"></span>' : '';
     $options = array('label' => $label, 'extras' => array('safe_label' => true));
     if ('#' == $config['route']) {
         $options['uri'] = '#';
     } elseif ($config['route']) {
         $options['route'] = $config['route'];
     }
     if ($root->getChild($name)) {
         $name .= microtime();
     }
     $MenuItem = $root->addChild($name, $options);
     if (isset($config['class'])) {
         $MenuItem->setAttribute('class', $config['class']);
     }
     if (isset($config['items'])) {
         foreach ($config['items'] as $item) {
             $this->addItem($MenuItem, $item);
         }
         if ($root->getLevel()) {
             $root->setChildrenAttribute('class', 'nav sub-nav');
             $root->setLinkAttribute('class', 'accordion-toggle');
         }
     }
 }
 protected function addIdNameMenu(MenuItem $menu)
 {
     $menu->addChild('IdName', array('uri' => '#', 'label' => '<i class="fa fa-bed"></i> IdName<i class="fa fa-angle-double-left pull-right"></i></a>', 'extras' => array('safe_label' => true), 'attributes' => array('class' => 'treeview')));
     $menu['IdName']->setChildrenAttribute('class', 'treeview-menu');
     $menu['IdName']->addChild('AddIdName', array('label' => 'Tambah IdName', 'route' => 'app_idname_new', 'attributes' => array('class' => 'treeview')));
     $menu['IdName']->addChild('ListIdName', array('label' => 'Daftar IdName', 'route' => 'app_idname_list', 'attributes' => array('class' => 'treeview')));
     return $menu;
 }
예제 #11
0
    public function testRenderWithCurrentItemNotAsLink()
    {
        $about = $this->menu->addChild('About', array('uri' => '/about'));
        $about->setCurrent(true);

        $rendered = '<li class="current last"><span>About</span></li>';
        $this->assertEquals($rendered, $this->renderer->renderItem($about, array('currentAsLink' => false)));
    }
예제 #12
0
 public function addChild($child, array $options = [])
 {
     if (!empty($options['route'])) {
         $options['uri'] = ['_name' => $options['route']];
         unset($options['route']);
     }
     return parent::addChild($child, $options);
 }
예제 #13
0
 private function addMenu(\Symforce\AdminBundle\Compiler\CacheObject\Menu $tree, \Knp\Menu\MenuItem $menu, $as_root = true)
 {
     if ($as_root) {
         $_menu = $menu;
     } else {
         $options = array('attributes' => array(), 'childrenAttributes' => array(), 'linkAttributes' => array(), 'extras' => array());
         $label = $this->translator->trans($tree->getLabel(), array(), $tree->getDomain());
         if ($tree->admin) {
             $admin_name = $tree->getName();
             if (!$this->loadder->auth($admin_name, 'list')) {
                 return;
             }
             $admin = $this->loadder->getAdminByName($admin_name);
             $options['uri'] = $admin->path('list');
         } else {
             if ($tree->getUrl()) {
                 $options['uri'] = $tree->getUrl();
             } else {
                 if ($tree->getRouteName()) {
                     $options['uri'] = $this->container->get('router')->generate($tree->getRouteName());
                 } else {
                     $options['uri'] = 'javascript:alert(0)';
                 }
             }
         }
         if ($tree->hasChildren()) {
             if ($menu->isRoot()) {
                 $options['attributes']['class'] = 'dropdown';
                 $options['extras']['caret'] = true;
             } else {
                 $options['attributes']['class'] = 'dropdown-submenu';
             }
             $options['childrenAttributes']['class'] = 'dropdown-menu bottom-down';
             $options['linkAttributes']['class'] = 'dropdown-toggle';
             $options['linkAttributes']['data-toggle'] = 'dropdown';
         }
         if (!$menu->isRoot()) {
             if (null !== $tree->getDivider()) {
                 if ($tree->getDivider()) {
                     $options['extras']['after_divider'] = true;
                 } else {
                     $options['extras']['before_divider'] = true;
                 }
             }
         }
         if (null !== $tree->getIcon()) {
             $options['extras']['icon'] = $tree->getIcon();
         }
         $_menu = $menu->addChild($label, $options);
     }
     foreach ($tree->getChildren() as $child) {
         $this->addMenu($child, $_menu, false);
     }
 }
    public function testPrettyRendering()
    {
        $menu = new MenuItem('Root li', new MenuFactory());
        $menu->setChildrenAttributes(array('class' => 'root'));
        $menu->addChild('Parent 1');
        $menu->addChild('Parent 2');
        $renderer = new ListRenderer();
        $rendered = <<<HTML
<ul class="root">
  <li class="first">
    <span>Parent 1</span>
  </li>
  <li class="last">
    <span>Parent 2</span>
  </li>
</ul>

HTML;
        $this->assertEquals($rendered, $renderer->render($menu));
    }
 public function testGetCurrentMenuItem()
 {
     $item = new MenuItem('testItem', $this->factory);
     $goodItem = new MenuItem('goodItem', $this->factory);
     $subItem = new MenuItem('subItem', $this->factory);
     $goodItem->addChild($subItem);
     $params = array('testItem' => false, 'goodItem' => false, 'subItem' => true);
     $this->matcher->expects($this->any())->method('isCurrent')->with($this->logicalOr($this->equalTo($item), $this->equalTo($goodItem), $this->equalTo($subItem)))->will($this->returnCallback(function ($param) use(&$params) {
         return $params[$param->getLabel()];
     }));
     $this->assertEquals($subItem, $this->manager->getCurrentMenuItem(array($item, $goodItem)));
 }
예제 #16
0
 /**
  * @param MenuItem      $menu
  * @param PageInterface $parent
  */
 protected function populateChildren(MenuItem $menu, PageInterface $parent)
 {
     foreach ($parent as $child) {
         if (!$child->getDisplay()) {
             continue;
         }
         $item = $this->factory->createItem($child->getTitle(), ['route' => $child->getRoute()]);
         // Store Page ID
         $item->setExtra('_page_id', $child->getId());
         $menu->addChild($item);
         $this->populateChildren($item, $child);
     }
 }
예제 #17
0
 /**
  * @param MenuItem $menu
  * @param array $extras
  *
  * @return MenuItem
  */
 public function buildAdminMenu(MenuItem $menu, array $extras = ['beforeCode' => '<i class="fa fa-angle-right"></i>'])
 {
     if ($this->hasAdmin()) {
         $extras = ['afterCode' => '<i class="fa fa-angle-left pull-right"></i>', 'beforeCode' => '<i class="fa fa-cubes"></i>'];
         $submenu = $menu->addChild($this->getShortName(), ['uri' => $this->container->get('router')->generate('cms_admin_index') . $this->getShortName() . '/'])->setAttribute('class', 'treeview')->setExtras($extras);
         $submenu->setChildrenAttribute('class', 'treeview-menu');
         /** @var \Doctrine\ORM\EntityManager $em */
         $em = $this->container->get('doctrine.orm.entity_manager');
         foreach ($em->getRepository('UnicatModule:UnicatConfiguration')->findAll() as $uc) {
             $submenu->addChild($uc->getTitle(), ['route' => 'unicat_admin.configuration', 'routeParameters' => ['configuration' => $uc->getName()]])->setExtras(['beforeCode' => '<i class="fa fa-angle-right"></i>']);
         }
     }
     return $menu;
 }
예제 #18
0
 /**
  * @dataProvider navigationConfigureDataProvider
  *
  * @param array $settings
  * @param bool  $isEnabled
  * @param bool  $expectedResult
  */
 public function testOnNavigationConfigure($settings, $isEnabled, $expectedResult)
 {
     $factory = new MenuFactory();
     $this->resolver->expects($this->any())->method('resolve')->will($this->returnArgument(0));
     $this->state->expects($this->once())->method('isEntityEnabled')->will($this->returnValue($isEnabled));
     $settingsProvider = new SettingsProvider($settings, $this->resolver);
     $listener = new NavigationListener($settingsProvider, $this->state);
     $menu = new MenuItem('test_menu', $factory);
     $salesTab = new MenuItem('sales_tab', $factory);
     $salesTab->addChild('test_item')->setDisplay(false);
     $menu->addChild($salesTab);
     $this->assertFalse($salesTab->getChild('test_item')->isDisplayed());
     $eventData = new ConfigureMenuEvent($factory, $menu);
     $listener->onNavigationConfigure($eventData);
     $this->assertEquals($expectedResult, $salesTab->getChild('test_item')->isDisplayed());
 }
 /**
  * @dataProvider getBreadcrumbManagerDataProvider
  * @param $expected
  * @param $menu
  * @param $route
  */
 public function testGetBreadcrumbLabels($expected, $menu, $route)
 {
     $this->provider->expects($this->any())->method('get')->will($this->returnCallback(function ($menu) {
         switch ($menu) {
             case BreadcrumbManager::FRONTEND_MENU:
                 $item = new MenuItem('frontend_menu__test', $this->factory);
                 $item->setExtra('routes', ['another_route', '/another_route/', 'another*route', 'route_with_frontend_true']);
                 $item1 = new MenuItem('frontend_menu__test1', $this->factory);
                 $item2 = new MenuItem('frontend_menu__sub_item', $this->factory);
                 $item1->addChild($item2);
                 $item1->setExtra('routes', []);
                 $item2->addChild($item);
                 return $item1;
             case 'test_menu':
                 $item = new MenuItem('test_menu__test', $this->factory);
                 $item->setExtra('routes', ['another_route', '/another_route/', 'another*route', 'route_without_frontend']);
                 $item1 = new MenuItem('test_menu__test1', $this->factory);
                 $item2 = new MenuItem('test_menu__sub_item', $this->factory);
                 $item1->addChild($item2);
                 $item1->setExtra('routes', []);
                 $item2->addChild($item);
                 return $item1;
         }
         return null;
     }));
     $this->assertEquals($expected, $this->manager->getBreadcrumbLabels($menu, $route));
 }
예제 #20
0
 /** ************************************************************************
  * Add menu child "Delete" to $menu
  * @param \Knp\Menu\MenuItem $menu
  * @param array $options
  **************************************************************************/
 protected function addChildDelete(MenuItem $menu, array $options)
 {
     $menu->addChild('Delete', array('uri' => '#'))->setAttribute('icon', 'glyphicon-trash')->setLinkAttribute('data-toggle', 'modal')->setLinkAttribute('data-target', '#confirm-delete')->setLinkAttribute('data-href', $this->container->get('router')->generate('finance_operation_stakeholder_delete', array('stakeholder_id' => $options['stakeholder']->getId())));
 }
예제 #21
0
파일: Builder.php 프로젝트: blab2015/seh
 private function buildItems(Menu $menu, MenuItem $knpMenu)
 {
     $locale = $this->bigfootContext->get('language');
     /**
      * @var Item $item
      */
     foreach ($menu->getItems() as $item) {
         $itemParameters = array('label' => $item->getLabel());
         $link = $item->getLink();
         if (isset($link['name'])) {
             $itemParameters['route'] = $link['name'];
             if ($this->router instanceof \BeSimple\I18nRoutingBundle\Routing\Router and $this->router->getRouteCollection()->get(sprintf('%s.%s', $link['name'], $locale))) {
                 $parameters['locale'] = $locale;
                 $options = $this->router->getRouteCollection()->get($link['name'] . '.' . $locale)->getOptions();
             } else {
                 $options = $this->router->getRouteCollection()->get($link['name'])->getOptions();
             }
             if (isset($options['label'])) {
                 $parameters = array();
                 $iParameters = $link['parameters'];
                 if (isset($options['parameters'])) {
                     foreach ($options['parameters'] as $key => $parameter) {
                         if (preg_match('/Bundle/i', $parameter['type'])) {
                             $entity = $this->entityManager->getRepository($parameter['type'])->find($iParameters[$parameter['name']]);
                             $method = 'get' . ucfirst($parameter['field']);
                             $parameters[$parameter['name']] = $entity->{$method}();
                             if (isset($parameter['childs'])) {
                                 foreach ($parameter['childs'] as $child) {
                                     $method = 'get' . ucfirst($child);
                                     $parameters[$child] = $entity->{$method}()->getSlug();
                                 }
                             }
                         } else {
                             $parameters[$parameter['name']] = $iParameters[$parameter['name']];
                         }
                     }
                 }
                 $itemParameters['routeParameters'] = $parameters;
                 $itemParameters['routeAbsolute'] = true;
             }
         } else {
             $itemParameters['uri'] = isset($link['externalLink']) ? $link['externalLink'] : '#';
         }
         $child = $knpMenu->addChild($item->getSlug(), $itemParameters);
         foreach ($item->getAttributesByType(Attribute::LINK) as $attribute) {
             $child->setLinkAttribute($attribute->getName(), $attribute->getValue());
         }
     }
     return $menu;
 }
예제 #22
0
 /** ************************************************************************
  * Add menu child "Delete" to $menu
  * @param \Knp\Menu\MenuItem $menu
  * @param array $options
  **************************************************************************/
 protected function addChildDelete(MenuItem $menu, array $options)
 {
     $menu->addChild('Delete', array('uri' => '#'))->setAttribute('icon', 'glyphicon-trash')->setLinkAttribute('data-toggle', 'modal')->setLinkAttribute('data-target', '#confirm-delete')->setLinkAttribute('data-href', $this->container->get('router')->generate('nutri_recipe_shoplist_delete', array('shoplist_id' => $options['shoplist']->getId())));
 }
 public function setUp()
 {
     date_default_timezone_set('Europe/London');
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->pool = new Pool($container, '', '');
     $this->pool->setAdminServiceIds(array('sonata_admin_foo_service'));
     $this->pool->setAdminClasses(array('fooClass' => array('sonata_admin_foo_service')));
     $this->router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
     $this->logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $menu = new MenuItem('bar', new MenuFactory());
     $menu->addChild('foo');
     $this->helper = $this->getMockBuilder('Knp\\Menu\\Twig\\Helper')->disableOriginalConstructor()->getMock();
     $this->helper->expects($this->any())->method('get')->with('my_menu')->willReturn($menu);
     $this->twigExtension = new SonataAdminExtension($this->pool, $this->router, $this->helper, $this->logger);
     $loader = new StubFilesystemLoader(array(__DIR__ . '/../../../Resources/views/CRUD'));
     $this->environment = new \Twig_Environment($loader, array('strict_variables' => true, 'cache' => false, 'autoescape' => true, 'optimizations' => 0));
     $this->environment->addExtension($this->twigExtension);
     // translation extension
     $translator = new Translator('en', new MessageSelector());
     $translator->addLoader('xlf', new XliffFileLoader());
     $translator->addResource('xlf', __DIR__ . '/../../../Resources/translations/SonataAdminBundle.en.xliff', 'en', 'SonataAdminBundle');
     $this->environment->addExtension(new TranslationExtension($translator));
     // routing extension
     $xmlFileLoader = new XmlFileLoader(new FileLocator(array(__DIR__ . '/../../../Resources/config/routing')));
     $routeCollection = $xmlFileLoader->load('sonata_admin.xml');
     $xmlFileLoader = new XmlFileLoader(new FileLocator(array(__DIR__ . '/../../Fixtures/Resources/config/routing')));
     $testRouteCollection = $xmlFileLoader->load('routing.xml');
     $routeCollection->addCollection($testRouteCollection);
     $requestContext = new RequestContext();
     $urlGenerator = new UrlGenerator($routeCollection, $requestContext);
     $this->environment->addExtension(new RoutingExtension($urlGenerator));
     $this->environment->addExtension(new \Twig_Extensions_Extension_Text());
     $this->twigExtension->initRuntime($this->environment);
     // initialize object
     $this->object = new \stdClass();
     // initialize admin
     $this->admin = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $this->admin->expects($this->any())->method('getCode')->will($this->returnValue('xyz'));
     $this->admin->expects($this->any())->method('id')->with($this->equalTo($this->object))->will($this->returnValue(12345));
     $this->admin->expects($this->any())->method('getNormalizedIdentifier')->with($this->equalTo($this->object))->will($this->returnValue(12345));
     $this->admin->expects($this->any())->method('trans')->will($this->returnCallback(function ($id) {
         return $id;
     }));
     $this->adminBar = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $this->adminBar->expects($this->any())->method('isGranted')->will($this->returnValue(true));
     $this->adminBar->expects($this->any())->method('getNormalizedIdentifier')->with($this->equalTo($this->object))->will($this->returnValue(12345));
     // for php5.3 BC
     $admin = $this->admin;
     $adminBar = $this->adminBar;
     $container->expects($this->any())->method('get')->will($this->returnCallback(function ($id) use($admin, $adminBar) {
         if ($id == 'sonata_admin_foo_service') {
             return $admin;
         } elseif ($id == 'sonata_admin_bar_service') {
             return $adminBar;
         }
         return;
     }));
     // initialize field description
     $this->fieldDescription = $this->getMock('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface');
     $this->fieldDescription->expects($this->any())->method('getName')->will($this->returnValue('fd_name'));
     $this->fieldDescription->expects($this->any())->method('getAdmin')->will($this->returnValue($this->admin));
     $this->fieldDescription->expects($this->any())->method('getLabel')->will($this->returnValue('Data'));
 }
 public function testRenderWithCurrentItemNotAsLink()
 {
     $menu = new MenuItem('test', new MenuFactory());
     $about = $menu->addChild('About', array('uri' => '/about'));
     $about->setCurrent(true);
     $rendered = '<ul><li class="current first last"><span>About</span></li></ul>';
     $this->assertEquals($rendered, $this->renderer->render($menu, array('currentAsLink' => false)));
 }
예제 #25
0
 /**
  * Create tree un KnpMenuItem.
  *
  * @param KnpMenuItem      $knpMenu
  * @param ItemInterface    $item
  * @param KnpMenuItem|null $parent
  *
  * @return KnpMenuItem A formatted KnpMenu
  */
 protected function getTree(KnpMenuItem $knpMenu, ItemInterface $item, KnpMenuItem $parent = null)
 {
     if ($parent === null) {
         $menuItem = $knpMenu->addChild($item);
     } else {
         $menuItem = $parent->addChild($item);
     }
     if (($uri = $item->getUri()) !== null) {
         if ($uri[0] == '/') {
             $baseUri = $this->request->getBasePath() . $this->request->getBaseURL() . $uri;
             $uri = $this->request->getSchemeAndHttpHost() . $baseUri;
             if ($baseUri === $this->currentUri) {
                 $menuItem->setCurrent(true);
             }
         }
         $menuItem->setUri($uri);
     }
     $menuItem->setAttributes(['position' => $item->getPosition(), 'slug' => $item->getSlug()]);
     foreach ($item->getChildren() as $child) {
         $this->getTree($knpMenu, $child, $menuItem);
     }
     $this->menuManipulator->moveToPosition($menuItem, $item->getPosition());
     return $menuItem;
 }
 /**
  * @expectedException LogicException
  */
 public function testAddChildFailsIfInAnotherMenu()
 {
     $factory = $this->getMock('Knp\\Menu\\FactoryInterface');
     $menu = new MenuItem('Root li', $factory);
     $child = new MenuItem('Child 3', $factory);
     $menu->addChild($child);
     $menu2 = new MenuItem('Second menu', $factory);
     $menu2->addChild($child);
 }
예제 #27
0
 protected function addChildWithExternalUrl()
 {
     $this->menu->addChild('child', array('uri' => 'http://www.symfony-reloaded.org'));
 }
예제 #28
0
 /** ************************************************************************
  * Add menu child "Ingredient" to $menu
  * @param \Knp\Menu\MenuItem $menu
  **************************************************************************/
 protected function addChildIngredient(MenuItem $menu)
 {
     $menu->addChild('Ingredient')->setAttribute('dropdown', true);
     $menu['Ingredient']->addChild('Home', array('route' => 'nutri_ingredient_ingredient_home'))->setAttribute('icon', 'glyphicon-list');
     $menu['Ingredient']->addChild('New', array('route' => 'nutri_ingredient_ingredient_add'))->setAttribute('icon', 'glyphicon-plus');
 }
예제 #29
0
 protected function createGiveawayMenu(MenuItem $menu)
 {
     if (class_exists('MadrakIO\\StreamPerk\\Bundle\\GiveawayBundle\\Entity\\Giveaway') === false) {
         return;
     }
     if ($this->configurationService->get('giveaway.enabled') !== true) {
         return;
     }
     $menu->addChild("Giveaway", ['route' => 'giveaway_list']);
 }
예제 #30
0
 public function addMenuParts(MenuItem $menu)
 {
     $menu->addChild('Home', array('route' => 'homepage'));
 }