/**
* 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);
}