当前位置: 首页>>代码示例>>PHP>>正文


PHP ItemInterface::addChild方法代码示例

本文整理汇总了PHP中Knp\Menu\ItemInterface::addChild方法的典型用法代码示例。如果您正苦于以下问题:PHP ItemInterface::addChild方法的具体用法?PHP ItemInterface::addChild怎么用?PHP ItemInterface::addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Knp\Menu\ItemInterface的用法示例。


在下文中一共展示了ItemInterface::addChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildCategoryMenu

 /**
  * @param \Knp\Menu\ItemInterface $menu        The item to fill with $routes
  * @param array                   $options     The item options
  * @param string                  $currentUri  The current URI
  */
 public function buildCategoryMenu(ItemInterface $menu, array $options = array(), $currentUri = null)
 {
     //$categories = $this->categoryManager->getCategoryTree();
     //$this->fillMenu($menu, $categories, $options, $currentUri);
     $menu->addChild('home', array('route' => 'home'));
     $menu->addChild('home2', array('route' => 'home'));
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:12,代码来源:MainMenuBuilder.php

示例2: configureSideMenu

 /**
  * @param MenuItemInterface $menu
  * @param $action
  * @param AdminInterface $childAdmin
  */
 protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     $pool = $this->container->get('sonata.admin.pool');
     $adminGroups = $pool->getAdminGroups();
     foreach ($adminGroups as $name => $adminGroup) {
         if (isset($adminGroup['items'])) {
             foreach ($adminGroup['items'] as $key => $id) {
                 $admin = $pool->getInstance($id);
                 if ($admin->showIn(Admin::CONTEXT_DASHBOARD)) {
                     $groups[$name]['items'][$key] = $admin;
                 } else {
                     unset($groups[$name]['items'][$key]);
                 }
             }
         }
         if (empty($groups[$name]['items'])) {
             unset($groups[$name]);
         }
     }
     $menu->addChild($this->trans('dashboard', [], 'admin'), array('uri' => $this->getRouteGenerator()->generate('sonata_admin_dashboard'), 'attributes' => array('class' => 'home')));
     foreach ($groups as $name => $group) {
         $parent = $menu->addChild('header_' . $this->trans($name), array('label' => $this->trans($name), 'attributes' => array('class' => 'submenu')));
         foreach ($group['items'] as $key => $admin) {
             $item = $parent->addChild($this->trans($admin->getLabel()), array('uri' => $admin->generateUrl('list')));
             if (get_class($this) == get_class($admin)) {
                 $parent[$this->trans($admin->getLabel())]->setCurrent(true);
                 //$item['header_'.$this->trans($name)]->setAttributes(array('class' => 'submenu open'));
             }
         }
     }
 }
开发者ID:bamper,项目名称:symfony-ecommerce,代码行数:36,代码来源:BaseAdmin.php

示例3: configureTabMenu

 /**
  * {@inheritdoc}
  */
 protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, ['list'])) {
         return;
     }
     $menu->addChild('link_queue_list', ['label' => 'Queues', 'attributes' => ['class' => 'btn', 'icon' => 'fa fa-tasks'], 'route' => 'sonata_queue_list']);
     $menu->addChild('link_queue_message_list', ['label' => 'Messages', 'attributes' => ['class' => 'btn', 'icon' => 'fa fa-send'], 'route' => 'sonata_queue_message_list']);
     $menu->addChild('link_queue_log_list', ['label' => 'Exceptions', 'attributes' => ['class' => 'btn', 'icon' => 'fa fa-terminal'], 'route' => 'sonata_queue_log_list']);
 }
开发者ID:heristop,项目名称:HeriJobQueueBundle,代码行数:12,代码来源:QueueTabMenuTrait.php

示例4: addAdminMenuItems

 /**
  * @param \Knp\Menu\ItemInterface $admin
  */
 private function addAdminMenuItems(ItemInterface $admin)
 {
     $context = $this->context;
     $admin->addChild('menu.admin.config', array('route' => 'dedipanel_core_config', 'extras' => array('icon' => 'icon-cogs')))->setDisplay($context->isGranted(User::ROLE_SUPER_ADMIN));
     $admin->addChild('menu.admin.user', array('route' => 'dedipanel_user_index', 'extras' => array('icon' => 'icon-uni2F')))->setDisplay($context->isGranted('ROLE_DP_ADMIN_USER_INDEX'));
     $admin->addChild('menu.admin.group', array('route' => 'dedipanel_group_index', 'extras' => array('icon' => 'icon-users')))->setDisplay($context->isGranted('ROLE_DP_ADMIN_GROUP_INDEX'));
     $admin->addChild('menu.admin.game', array('route' => 'dedipanel_game_index', 'extras' => array('icon' => 'icon-steam3')))->setDisplay($context->isGranted('ROLE_DP_ADMIN_GAME_INDEX'));
     $admin->addChild('menu.admin.plugin', array('route' => 'dedipanel_plugin_index', 'extras' => array('icon' => 'icon-uni34')))->setDisplay($context->isGranted('ROLE_DP_ADMIN_PLUGIN_INDEX'));
 }
开发者ID:Onneil,项目名称:dedipanel,代码行数:12,代码来源:MenuBuilder.php

示例5: configureSideMenu

 /**
  * {@inheritdoc}
  */
 protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, array('edit'))) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild($this->trans('sonata_comment_admin_edit', array(), 'SonataCommentBundle'), array('uri' => $admin->generateUrl('edit', array('id' => $id))));
     $menu->addChild($this->trans('sonata_comment_admin_view_comments', array(), 'SonataCommentBundle'), array('uri' => $admin->generateUrl('sonata.comment.admin.comment.list', array('id' => $id))));
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:13,代码来源:ThreadAdmin.php

示例6: configureSideMenu

 protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, array('edit', 'show'))) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild('view', array('uri' => $admin->generateUrl('show', array('id' => $id))));
     $menu->addChild('replies', array('uri' => $admin->generateUrl('sonata.admin.module.ticket.replies.list', array('id' => $id))));
 }
开发者ID:c4d3r,项目名称:mcsuite-application-eyeofender,代码行数:10,代码来源:TicketAdmin.php

示例7: configureSideMenu

 /**
  * (non-PHPdoc).
  *
  * @see \Sonata\AdminBundle\Admin\Admin::configureSideMenu()
  */
 protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, ['edit'])) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild('menu.menu', ['uri' => $admin->generateUrl('edit', ['id' => $id]), 'label' => $this->trans('zapoyok_menu.menu.menu')]);
     $menu->addChild('menu.node', ['uri' => $admin->generateUrl('zapoyok_menu.admin.menunode.list', ['id' => $id]), 'label' => $this->trans('zapoyok_menu.menu.nodes')]);
 }
开发者ID:zapoyok,项目名称:menu-bundle,代码行数:15,代码来源:MenuAdmin.php

示例8: configureSideMenu

 /**
  * {@inheritdoc}
  */
 protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, array('edit'))) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild('Tournament', $admin->generateMenuUrl('edit', array('id' => $id)));
     $menu->addChild('Peloton', $admin->generateMenuUrl('admin.archery.peloton.list', array('id' => $id)));
 }
开发者ID:Valdior,项目名称:Archery,代码行数:13,代码来源:TournamentAdmin.php

示例9: buildMainMenu

 public function buildMainMenu(Request $request, ItemInterface $root)
 {
     $root->addChild('Messages', ['route' => 'pjax_message_index'])->getParent()->addChild('New message', ['route' => 'pjax_message_new'])->getParent();
     $latests = $root->addChild('latests', ['dropdown' => true]);
     /** @var Message $message */
     foreach ($this->messageRepository->findBy([], array(), 4) as $message) {
         $latests->addChild($message->getId(), ['route' => 'pjax_message_show', 'routeParameters' => ['id' => $message->getId()], 'label' => 'message ' . $message->getId()]);
     }
     return $root;
 }
开发者ID:hyperunknown,项目名称:PjaxDemo,代码行数:10,代码来源:MenuBuilder.php

示例10: configureSideMenu

 /**
  * @param \Knp\Menu\ItemInterface $menu
  * @param $action
  * @param null|\Sonata\AdminBundle\Admin\Admin $childAdmin
  *
  * @return void
  */
 protected function configureSideMenu(MenuItemInterface $menu, $action, Admin $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, array('edit'))) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild($this->trans('Content Show'), array('uri' => $admin->generateUrl('show', array('id' => $id))));
     $menu->addChild($this->trans('Content Site Show'), array('uri' => $admin->getSubject()->getSitePath(), 'linkAttributes' => array('target' => '_blank')));
 }
开发者ID:khasinski,项目名称:Iphp,代码行数:17,代码来源:ContentAdmin.php

示例11: configureSideMenu

 /**
  * {@inheritdoc}
  */
 protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, array('edit'))) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild($this->trans('customer.sidemenu.link_customer_edit', array(), 'SonataCustomerBundle'), $admin->generateMenuUrl('edit', array('id' => $id)));
     $menu->addChild($this->trans('customer.sidemenu.link_address_list', array(), 'SonataCustomerBundle'), $admin->generateMenuUrl('sonata.customer.admin.address.list', array('id' => $id)));
     $menu->addChild($this->trans('customer.sidemenu.link_order_list', array(), 'SonataCustomerBundle'), $admin->generateMenuUrl('sonata.order.admin.order.list', array('id' => $id)));
 }
开发者ID:kinkinweb,项目名称:lhvb,代码行数:14,代码来源:CustomerAdmin.php

示例12: configureTabMenu

 /**
  * @param MenuItemInterface $menu
  * @param $action
  * @param AdminInterface $childAdmin
  * @return mixed|void
  */
 protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if ($childAdmin !== null || !in_array($action, array('edit', 'show'))) {
         return;
     }
     /** @var Movie $movie */
     $movie = $this->getSubject();
     $router = $this->getConfigurationPool()->getContainer()->get('router');
     $menu->addChild($this->trans('form.label_sessions'), array('uri' => $router->generate('movie_movie_child_session_list', array('id' => $movie->getId()))));
     $menu->addChild($this->trans('form.label_comments'), array('uri' => $router->generate('movie_movie_child_comment_list', array('id' => $movie->getId()))));
 }
开发者ID:glavweb,项目名称:rest-demo-app,代码行数:17,代码来源:MovieAdmin.php

示例13: configureTabMenu

 /**
  * {@inheritdoc}
  */
 protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, array('edit'))) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild($this->trans('employee', array(), 'AppBundle'), $admin->generateMenuUrl('edit', array('id' => $id)));
     $menu->addChild($this->trans('payroll_list', array(), 'AppBundle'), $admin->generateMenuUrl('app.payroll.list', array('id' => $id)));
     $menu->addChild($this->trans('vacation_list', array(), 'AppBundle'), $admin->generateMenuUrl('app.vacation.list', array('id' => $id)));
     $menu->addChild($this->trans('timesheet_list', array(), 'AppBundle'), $admin->generateMenuUrl('app.timesheet.list', array('id' => $id)));
 }
开发者ID:Nexotap,项目名称:Ivory,代码行数:15,代码来源:EmployeeAdmin.php

示例14: configureSideMenu

 /**
  * {@inheritdoc}
  */
 protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, array('edit'))) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild($this->trans('sidemenu.link_edit_post', array(), 'SonataNewsBundle'), array('uri' => $admin->generateUrl('edit', array('id' => $id))));
     if ($this->hasSubject() && $this->getSubject()->getId() !== null) {
         $menu->addChild($this->trans('sidemenu.link_view_post'), array('uri' => $admin->getRouteGenerator()->generate('sonata_news_view', array('permalink' => $this->permalinkGenerator->generate($this->getSubject())))));
     }
 }
开发者ID:symbio,项目名称:orangegate4-news-bundle,代码行数:15,代码来源:PostAdmin.php

示例15: addSignedInuser

 private function addSignedInuser(ItemInterface $root)
 {
     $user = $this->getSignedInUser();
     if ($user) {
         $user = $root->addChild($user->getEmail());
         $user->addChild('web.menu.web', array('route' => 'homepage'));
         $user->addChild('web.menu.admin', array('route' => 'admin_homepage'));
         $user->addChild('web.menu.logout', array('route' => 'fos_user_security_logout'));
     } else {
         $root->addChild('web.menu.login', array('route' => 'fos_user_security_login'));
     }
     return $user;
 }
开发者ID:Nemrtvej,项目名称:symfony-template,代码行数:13,代码来源:Builder.php


注:本文中的Knp\Menu\ItemInterface::addChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。