setMenuItemTheme() 공개 메소드

Set menu config consisting of theme identifiers
public setMenuItemTheme ( MenuItem $item, string $desktopTheme, string $mobileTheme ) : void
$item Xpressengine\Menu\Models\MenuItem menu item instance
$desktopTheme string theme id
$mobileTheme string theme id
리턴 void
예제 #1
0
 /**
  * storeItem
  *
  * @param MenuHandler     $handler menu handler
  * @param string          $menuId  where to store
  *
  * @return $this|RedirectResponse
  * @throws Exception
  */
 public function storeItem(MenuHandler $handler, $menuId)
 {
     XeDB::beginTransaction();
     $menu = $handler->get($menuId);
     try {
         $inputs = Input::except(['_token', 'theme_desktop', 'theme_mobile']);
         $parentThemeMode = Input::get('parentTheme', false);
         if ($parentThemeMode === false) {
             $desktopTheme = Input::get('theme_desktop');
             $mobileTheme = Input::get('theme_mobile');
         } else {
             $desktopTheme = null;
             $mobileTheme = null;
         }
         list($itemInput, $menuTypeInput) = $this->inputClassify($inputs);
         $itemInput['parent'] = $itemInput['parent'] === $menu->getKey() ? null : $itemInput['parent'];
         $item = $handler->createItem($menu, ['title' => $itemInput['itemTitle'], 'url' => $itemInput['itemUrl'], 'description' => $itemInput['itemDescription'], 'target' => $itemInput['itemTarget'], 'type' => $itemInput['selectedType'], 'ordering' => $itemInput['itemOrdering'], 'activated' => isset($itemInput['itemActivated']) ? $itemInput['itemActivated'] : 0, 'parentId' => $itemInput['parent']], $menuTypeInput);
         // link image 등록
         $this->registerItemImage($item, 'basicImage');
         $this->registerItemImage($item, 'hoverImage');
         $this->registerItemImage($item, 'selectedImage');
         $this->registerItemImage($item, 'mBasicImage');
         $this->registerItemImage($item, 'mHoverImage');
         $this->registerItemImage($item, 'mSelectedImage');
         $handler->putItem($item, $menuTypeInput);
         $handler->setMenuItemTheme($item, $desktopTheme, $mobileTheme);
         $this->permissionRegisterGrant($handler->permKeyString($item), null, $menu->siteKey);
     } catch (Exception $e) {
         XeDB::rollback();
         Input::flash();
         return Redirect::back()->with('alert', ['type' => 'danger', 'message' => $e->getMessage()]);
     }
     XeDB::commit();
     return Redirect::route('settings.menu.index');
 }