getMenuItemTheme() 공개 메소드

Get menu item config consisting of theme identifiers
public getMenuItemTheme ( MenuItem $item ) : ConfigEntity
$item Xpressengine\Menu\Models\MenuItem menu item instance
리턴 Xpressengine\Config\ConfigEntity
예제 #1
0
 /**
  * setInstanceConfig
  *
  * @param InstanceRoute $instanceRoute instance route
  * @param XeRequest     $request       xpressengine request
  *
  * @return void
  */
 private function setInstanceConfig(InstanceRoute $instanceRoute, XeRequest $request)
 {
     $item = $this->menuHandler->getItem($instanceRoute->instanceId);
     $menuConfig = $this->menuHandler->getMenuItemTheme($item);
     if ($request->isMobile()) {
         $theme = $menuConfig->get('mobileTheme');
     } else {
         $theme = $menuConfig->get('desktopTheme');
     }
     $instanceId = $instanceRoute->instanceId;
     $module = $instanceRoute->module;
     $url = $instanceRoute->url;
     $instanceConfig = InstanceConfig::instance();
     $instanceConfig->setTheme($theme);
     $instanceConfig->setInstanceId($instanceId);
     $instanceConfig->setModule($module);
     $instanceConfig->setUrl($url);
     $themeHandler = $this->themeHandler;
     $themeHandler->selectTheme($theme);
 }
예제 #2
0
 /**
  * editItem
  * 선택된 메뉴의 아이템을 view & edit 페이지 구성
  *
  * @param MenuHandler   $handler menu handler
  * @param ModuleHandler $modules module handler
  * @param SiteHandler   $sites   site handler
  * @param string        $menuId  menu id
  * @param string        $itemId  item id
  *
  * @return RendererInterface
  */
 public function editItem(MenuHandler $handler, ModuleHandler $modules, SiteHandler $sites, $menuId, $itemId)
 {
     $item = $handler->getItem($itemId, ['basicImage', 'hoverImage', 'selectedImage', 'mBasicImage', 'mHoverImage', 'mSelectedImage']);
     $menu = $item->menu;
     if ($menu->getKey() !== $menuId) {
         throw new InvalidArgumentHttpException(400);
     }
     try {
         $menuType = $modules->getModuleObject($item->type);
     } catch (NotFoundModuleException $e) {
         $menuType = null;
     }
     $homeId = $sites->getHomeInstanceId();
     $itemConfig = $handler->getMenuItemTheme($item);
     $desktopTheme = $itemConfig->getPure('desktopTheme');
     $mobileTheme = $itemConfig->getPure('mobileTheme');
     $parentThemeMode = false;
     if ($desktopTheme === null && $mobileTheme === null) {
         $parentThemeMode = true;
     }
     $parentConfig = $itemConfig->getParent();
     return XePresenter::make('menu.editItem', ['menu' => $menu, 'item' => $item, 'homeId' => $homeId, 'menuType' => $menuType, 'parentThemeMode' => $parentThemeMode, 'itemConfig' => $itemConfig, 'parentConfig' => $parentConfig]);
 }