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


PHP ItemInterface::removeChild方法代码示例

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


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

示例1: addConfigurationMenu

 /**
  * @param ItemInterface $menu
  */
 private function addConfigurationMenu(ItemInterface $menu)
 {
     $child = $menu->addChild('configuration')->setLabel('sylius.menu.admin.main.configuration.header');
     if (!$child->hasChildren()) {
         $menu->removeChild('configuration');
     }
 }
开发者ID:sidibea,项目名称:Sylius,代码行数:10,代码来源:MainMenuBuilder.php

示例2: addConfigurationMenu

 /**
  * @param ItemInterface $menu
  */
 private function addConfigurationMenu(ItemInterface $menu)
 {
     $child = $menu->addChild('configuration')->setLabel('sylius.menu.admin.main.configuration.header');
     $child->addChild('tax_categories', ['route' => 'sylius_admin_tax_category_index'])->setLabel('sylius.menu.admin.main.configuration.tax_categories')->setLabelAttribute('icon', 'tags');
     $child->addChild('countries', ['route' => 'sylius_admin_country_index'])->setLabel('sylius.menu.admin.main.configuration.countries')->setLabelAttribute('icon', 'flag');
     $child->addChild('locale', ['route' => 'sylius_admin_locale_index'])->setLabel('sylius.menu.admin.main.configuration.locales')->setLabelAttribute('icon', 'translate');
     if (!$child->hasChildren()) {
         $menu->removeChild('configuration');
     }
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:13,代码来源:MainMenuBuilder.php

示例3: filterMenu

 public function filterMenu(ItemInterface $menu)
 {
     foreach ($menu->getChildren() as $child) {
         /** @var \Knp\Menu\MenuItem $child */
         $routes = $child->getExtra('routes');
         if ($routes !== null) {
             $route = current(current($routes));
             if ($route && !$this->hasRouteAccess($route)) {
                 $menu->removeChild($child);
             }
         }
         $this->filterMenu($child);
     }
     return $menu;
 }
开发者ID:timy-life,项目名称:symfony2-advanced-menus,代码行数:15,代码来源:Builder.php

示例4: addAssortmentMenu

 /**
  * Add assortment menu.
  *
  * @param ItemInterface $menu
  * @param array         $childOptions
  * @param string        $section
  */
 protected function addAssortmentMenu(ItemInterface $menu, array $childOptions, $section)
 {
     $child = $menu->addChild('assortment', $childOptions)->setLabel($this->translate(sprintf('sylius.backend.menu.%s.assortment', $section)));
     if ($this->authorizationChecker->isGranted('sylius.taxonomy.index')) {
         $child->addChild('taxonomies', array('route' => 'sylius_backend_taxonomy_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-folder-close')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.taxonomies', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.product.index')) {
         $child->addChild('products', array('route' => 'sylius_backend_product_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-th-list')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.products', $section)));
         $child->addChild('bonuses', array('route' => 'sylius_backend_product_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-th-list')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.bonuses', $section)));
         $child->addChild('inventory', array('route' => 'sylius_backend_inventory_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-tasks')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.stockables', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.product_option.index')) {
         $child->addChild('options', array('route' => 'sylius_backend_product_option_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-th')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.options', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.product_attribute.index')) {
         $child->addChild('product_attributes', array('route' => 'sylius_backend_product_attribute_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-list-alt')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.attributes', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.product_archetype.index')) {
         $child->addChild('product_archetypes', array('route' => 'sylius_backend_product_archetype_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-compressed')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.archetypes', $section)));
     }
     if (!$child->hasChildren()) {
         $menu->removeChild('assortment');
     }
 }
开发者ID:starspire,项目名称:eventmanager,代码行数:31,代码来源:OverridedBackendMenuBuilder.php

示例5: addConfigurationMenu

 /**
  * Add configuration menu.
  *
  * @param ItemInterface $menu
  * @param array         $childOptions
  * @param string        $section
  */
 protected function addConfigurationMenu(ItemInterface $menu, array $childOptions, $section)
 {
     $child = $menu->addChild('configuration', $childOptions)->setLabel($this->translate(sprintf('sylius.backend.menu.%s.configuration', $section)));
     if ($this->authorizationChecker->isGranted('sylius.settings.general')) {
         $child->addChild('general_settings', array('route' => 'sylius_backend_general_settings', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-info-sign')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.general_settings', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.settings.security')) {
         $child->addChild('security_settings', array('route' => 'sylius_backend_security_settings', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-lock')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.security_settings', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.channel.index')) {
         $child->addChild('channels', array('route' => 'sylius_backend_channel_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.channels', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.locale.index')) {
         $child->addChild('locales', array('route' => 'sylius_backend_locale_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-flag')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.locales', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.payment_method.index')) {
         $child->addChild('payment_methods', array('route' => 'sylius_backend_payment_method_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-credit-card')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.payment_methods', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.currency.index')) {
         $child->addChild('currencies', array('route' => 'sylius_backend_currency_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-usd')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.currencies', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.settings.taxation')) {
         $child->addChild('taxation_settings', array('route' => 'sylius_backend_taxation_settings', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.taxation_settings', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.tax_category.index')) {
         $child->addChild('tax_categories', array('route' => 'sylius_backend_tax_category_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.tax_categories', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.tax_rate.index')) {
         $child->addChild('tax_rates', array('route' => 'sylius_backend_tax_rate_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.tax_rates', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.shipping_category.index')) {
         $child->addChild('shipping_categories', array('route' => 'sylius_backend_shipping_category_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.shipping_categories', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.shipping_method.index')) {
         $child->addChild('shipping_methods', array('route' => 'sylius_backend_shipping_method_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.shipping_methods', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.country.index')) {
         $child->addChild('countries', array('route' => 'sylius_backend_country_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-flag')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.countries', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.zone.index')) {
         $child->addChild('zones', array('route' => 'sylius_backend_zone_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-globe')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.zones', $section)));
     }
     if ($this->authorizationChecker->isGranted('sylius.api_client.index')) {
         $child->addChild('api_clients', array('route' => 'sylius_backend_api_client_index', 'labelAttributes' => array('icon' => 'glyphicon glyphicon-globe')))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.api_clients', $section)));
     }
     if (!$child->hasChildren()) {
         $menu->removeChild('configuration');
     }
 }
开发者ID:bendavies,项目名称:Sylius,代码行数:56,代码来源:BackendMenuBuilder.php


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