當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。