Xpressengine\Menu\MenuHandler::getItem PHP Method

getItem() public method

Get menu item
public getItem ( string $id, array $with = [] ) : MenuItem
$id string menu item identifier
$with array relation
return Xpressengine\Menu\Models\MenuItem
    public function getItem($id, $with = [])
    {
        return $this->repo->findItem($id, $with);
    }

Usage Example

Ejemplo n.º 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);
 }
All Usage Examples Of Xpressengine\Menu\MenuHandler::getItem