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


PHP Menu::run方法代码示例

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


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

示例1: run

 /**
  * Renders the menu.
  */
 public function run()
 {
     // Get Module list
     $modules = array_keys(Yii::$app->modules);
     // Get sub menu for each module
     foreach ($modules as $moduleName) {
         // Get module
         $moduleObj = Yii::$app->getModule($moduleName);
         $iconClass = isset($moduleObj->iconClass) ? $moduleObj->iconClass : 'fa-dashboard';
         // Get menu
         if (property_exists($moduleObj, 'backendMenu')) {
             $getModule = Yii::$app->request->get('module');
             $item = ['label' => Icon::show($iconClass) . '<span class="nav-label">' . Yii::t($moduleName, ucfirst($moduleName)) . '</span>', 'url' => ['/' . $moduleName . '/default']];
             if (Yii::$app->controller->module->id == $moduleName and empty($getModule) or $getModule == $moduleName) {
                 $item['active'] = TRUE;
             }
             $backendMenu = $moduleObj->backendMenu;
             if (is_array($backendMenu)) {
                 foreach ($backendMenu as $itemMenu) {
                     if (isset($itemMenu['access']) and $this->checkAccess($itemMenu['access'])) {
                         $item['items'][] = ['label' => $itemMenu['label'], 'url' => $itemMenu['url']];
                     }
                 }
                 if (isset($item['items']) and !empty($item['items'])) {
                     $item['label'] .= '<span class="fa arrow"></span>';
                 }
             }
             // assign to $this->items
             $this->items[] = $item;
         }
     }
     parent::run();
 }
开发者ID:quynhvv,项目名称:stepup,代码行数:36,代码来源:BackendMenu.php

示例2: run

 /**
  * Renders the menu.
  */
 public function run()
 {
     $this->options = ['tag' => 'ul', 'class' => 'nav navbar-nav navbar-right'];
     $this->encodeLabels = false;
     $this->items[] = ['label' => \Yii::t('app', 'Home'), 'url' => [DummyModel::getHomeRoute()]];
     /** @var ArticleCategory[] $categories */
     $categories = ArticleCategory::find()->from(['t' => ArticleCategory::tableName()])->joinWith(['articles'], true, 'RIGHT JOIN')->andWhere(['t.published' => 1])->orderBy('t.position DESC, t.id')->groupBy('t.id')->all();
     \Yii::$app->params['categoryModels'] = $categories;
     foreach ($categories as $category) {
         $this->items[] = ['label' => $category->label, 'url' => [ArticleCategory::getIndexRoute(), 'alias' => $category->alias]];
     }
     parent::run();
 }
开发者ID:tolik505,项目名称:bl,代码行数:16,代码来源:MainMenuWidget.php

示例3: run

 /**
  * Renders the menu.
  */
 public function run()
 {
     $controller = \Yii::$app->controller;
     $moduleObj = $controller->module;
     $paths = [];
     $moduleId = isset($moduleObj->id) ? $moduleObj->id : false;
     if ($moduleId && in_array($moduleId, ['fin', 'net', 'jar', 'oef'])) {
         $paths[] = $moduleId;
     }
     $paths[] = $controller->id;
     $this->objectId = isset($controller->objectId) ? $controller->objectId : false;
     $this->pathPattern = '/^\\/' . implode('\\/', $paths) . '\\/.*$/';
     parent::run();
 }
开发者ID:kaihatsusha,项目名称:kpimon,代码行数:17,代码来源:Menu.php

示例4: run

 public function run()
 {
     ob_start();
     parent::run();
     $body = ob_get_contents();
     ob_end_clean();
     // Adds the header
     if ($this->header) {
         $encodeHeader = ArrayHelper::getValue($this->options, 'encodeHeader', TRUE);
         $header = strtr($this->headerTemplate, ['{header}' => $encodeHeader ? Html::encode($this->header) : $this->header]);
         $body = $header . $body;
     }
     echo Html::tag('div', $body, ['class' => 'sidebar']);
 }
开发者ID:AtuinCMS,项目名称:atuin-menus,代码行数:14,代码来源:Widget.php

示例5: run

 public function run()
 {
     if ($this->cache) {
         /** @var Cache $cache */
         $this->cache = Instance::ensure($this->cache, Cache::className());
         $cacheKey = [__CLASS__, $this->items];
         if (($this->items = $this->cache->get($cacheKey)) === false) {
             $this->items = ModuleEvent::trigger(self::EVENT_FETCH_ITEMS, new MenuItemsEvent(['items' => $this->items]), 'items');
             $this->cache->set($cacheKey, $this->items, $this->cacheDuration, $this->cacheDependency);
         }
     } else {
         $this->items = ModuleEvent::trigger(self::EVENT_FETCH_ITEMS, new MenuItemsEvent(['items' => $this->items]), 'items');
     }
     $this->items += $this->customItems;
     parent::run();
     // TODO: Change the autogenerated stub
 }
开发者ID:oakcms,项目名称:oakcms,代码行数:17,代码来源:Menu.php

示例6: run

 /**
  * Renders the widget.
  */
 public function run()
 {
     parent::run();
     $view = $this->getView();
     $id = $this->options['id'];
     if ($this->clientOptions !== false) {
         $options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
         $js = "jQuery('#{$id}').menu({$options});";
         $view->registerJs($js);
     }
     if (!empty($this->clientEvents)) {
         $js = [];
         foreach ($this->clientEvents as $event => $handler) {
             $js[] = "jQuery('#{$id}').on('menu{$event}', {$handler});";
         }
         $view->registerJs(implode("\n", $js));
     }
 }
开发者ID:bandodebits,项目名称:yii2-bdb-menu,代码行数:21,代码来源:Menu.php

示例7: run

 /**
  * Renders the widget.
  */
 public function run()
 {
     echo Html::beginTag('div', ['class' => 'page-sidebar-wrapper']);
     echo Html::beginTag('div', ['class' => 'page-sidebar navbar-collapse collapse']);
     parent::run();
     echo Html::endTag('div');
     echo Html::endTag('div');
 }
开发者ID:chenyuzou,项目名称:yii2-theme-metronic,代码行数:11,代码来源:Menu.php

示例8: run

 /**
  * Renders the widget.
  */
 public function run()
 {
     echo Html::beginTag('div', ['class' => 'page-sidebar-wrapper']);
     echo Html::beginTag('div', ['class' => 'page-sidebar navbar-collapse collapse']);
     echo Html::beginTag('ul', $this->options);
     echo $this->toggleMenu ? $this->toggleMenu : '';
     if ($this->searchMenu) {
         $options = ArrayHelper::merge(['url' => '', 'method' => 'GET', 'name' => 'keyword', 'placeholder' => '搜索'], $this->searchMenu);
         echo strtr($this->_searchTemplate, ['{action}' => Url::to($options['url']), '{method}' => $options['method'], '{name}' => $options['name'], '{placeholder}' => $options['placeholder']]);
     }
     parent::run();
     echo Html::endTag('ul');
     echo Html::endTag('div');
     echo Html::endTag('div');
 }
开发者ID:su-xiaolin,项目名称:yii2-metronic,代码行数:18,代码来源:Menu.php

示例9: run

 public function run()
 {
     $this->items = $this->getMenuItems();
     parent::run();
 }
开发者ID:ahb360,项目名称:yii2-admin360,代码行数:5,代码来源:AdminSidebarMenu.php

示例10: run

 public function run()
 {
     parent::run();
     $this->itemOffset = 0;
 }
开发者ID:samdark,项目名称:yii2-iconized-menu-widget,代码行数:5,代码来源:Menu.php

示例11: run

 public function run()
 {
     $this->registerScript();
     parent::run();
 }
开发者ID:NullRefExcep,项目名称:yii2-sb-admin-2,代码行数:5,代码来源:MetisMenu.php

示例12: run

 public function run()
 {
     $view = $this->getView();
     LangSwitcherAsset::register($view);
     parent::run();
 }
开发者ID:filsh,项目名称:yii2-platform,代码行数:6,代码来源:LangSwitcher.php


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