/** * Copies the content from the other page given. * @param \Cx\Core\ContentManager\Model\Entity\Page $page */ public function getFallbackContentFrom($page) { $this->isVirtual = true; $this->content = $page->getContent(); $this->module = $page->getModule(); $this->cmd = $page->getCmd(); $this->skin = $page->getSkin(); $this->customContent = $page->getCustomContent(); $this->cssName = $page->getCssName(); $this->cssNavName = $page->getCssNavName(); $this->type = $page->getType(); $this->target = $page->getTarget(); }
/** * Copies the content from the other page given. * @param \Cx\Core\ContentManager\Model\Entity\Page $page * @param boolean $includeThemeOptions (optional) Wheter to adopt theme options as well (default false) */ public function setContentOf($page, $includeThemeOptions = false) { $this->isVirtual = true; $this->content = $page->getContent(); $this->module = $page->getModule(); $this->cmd = $page->getCmd(); if ($includeThemeOptions) { $this->skin = $page->getSkin(); $this->customContent = $page->getCustomContent(); $this->applicationTemplate = $page->getApplicationTemplate(); $this->cssName = $page->getCssName(); } $this->cssNavName = $page->getCssNavName(); $this->type = $page->getType(); $this->target = $page->getTarget(); }
/** * Fetch the application template of a content page. * @param \Cx\Core\ContentManager\Model\Entity\Page $page The page object of which to fetch the application template from * @param String $component Optional argument to specify the component to load the template from, instead of using the page's module-attribute * @param String $themeType Optional argument to specify the output channel * @return String The content of the application template */ public static function getContentTemplateOfPage($page, $component = null, $themeType = \Cx\Core\View\Model\Entity\Theme::THEME_TYPE_WEB) { try { $component = empty($component) ? $page->getModule() : $component; $cmd = !$page->getCmd() ? 'Default' : ucfirst($page->getCmd()); $customAppTemplate = !$page->getApplicationTemplate() ? $cmd . '.html' : $page->getApplicationTemplate(); $moduleFolderName = contrexx_isCoreModule($page->getModule()) ? 'core_modules' : 'modules'; $themeFolderName = \Env::get('init')->getCurrentThemesPath(); // use application template for all output channels if ($page->getUseCustomApplicationTemplateForAllChannels() && $page->getSkin()) { $themeRepo = new \Cx\Core\View\Model\Repository\ThemeRepository(); $themeFolderName = $themeRepo->findById($page->getSkin())->getFoldername(); } // use default theme in case a custom set theme is no longer available if (empty($themeFolderName)) { $themeRepo = new \Cx\Core\View\Model\Repository\ThemeRepository(); $themeFolderName = $themeRepo->getDefaultTheme($themeType, $page->getLang())->getFoldername(); } $cx = \Cx\Core\Core\Controller\Cx::instanciate(); // load custom application template from page's theme $themePath = $cx->getClassLoader()->getFilePath($cx->getWebsiteThemesPath() . '/' . $themeFolderName . '/' . $moduleFolderName . '/' . $component . '/Template/Frontend/' . $customAppTemplate); if ($themePath) { return file_get_contents($themePath); } // load default application template from page's theme if ($customAppTemplate != $cmd . '.html') { $themePath = $cx->getClassLoader()->getFilePath($cx->getWebsiteThemesPath() . '/' . $themeFolderName . '/' . $moduleFolderName . '/' . $component . '/Template/Frontend/' . $cmd . '.html'); if ($themePath) { return file_get_contents($themePath); } } // load default application template from component $modulePath = $cx->getClassLoader()->getFilePath($cx->getCodeBaseDocumentRootPath() . '/' . $moduleFolderName . '/' . $component . '/View/Template/Frontend/' . $cmd . '.html'); if ($modulePath) { return file_get_contents($modulePath); } return; } catch (\Exception $e) { throw new \Exception('Error fetching the content template:' . $e); } }
public function getSkin() { $this->_load(); return parent::getSkin(); }