예제 #1
0
 public function getMenuItemOptions()
 {
     $model = new MenusModel();
     $model->loadPlugin($this->getPluginCodeObj()->toCode());
     $result = [];
     foreach ($model->menus as $itemInfo) {
         if (!isset($itemInfo['label']) || !isset($itemInfo['code'])) {
             continue;
         }
         $itemCode = $itemInfo['code'];
         $result[$itemCode] = Lang::get($itemInfo['label']);
         if (!isset($itemInfo['sideMenu'])) {
             continue;
         }
         foreach ($itemInfo['sideMenu'] as $itemInfo) {
             if (!isset($itemInfo['label']) || !isset($itemInfo['code'])) {
                 continue;
             }
             $subItemCode = $itemInfo['code'];
             $result[$itemCode . '||' . $subItemCode] = str_repeat(' ', 4) . Lang::get($itemInfo['label']);
         }
     }
     return $result;
 }
 protected function loadOrCreateBaseModel($pluginCode, $options = [])
 {
     $model = new MenusModel();
     $model->loadPlugin($pluginCode);
     return $model;
 }