private function initBasePages($languages) { $templates = $this->theme->getTemplates(); foreach ($languages as $language) { $blocks = $this->blockRepository->retrieveContents(array(1, $language->getId()), 1); foreach ($templates as $template) { $this->pageBlocks->setBlocks($blocks); $this->pages['base'][] = $this->initPageTree($language, null, $template); } } }
/** * Saves the current theme structure into a file * * @param ThemeInterface $theme * @param string $themeStructureFile * @throws \Exception */ protected function saveThemeStructure(ThemeInterface $theme, $themeStructureFile) { $templates = array(); foreach ($this->languagesRepository->activeLanguages() as $language) { foreach ($this->pagesRepository->activePages() as $page) { $key = $language->getId() . '-' . $page->getId(); $templates[$key] = $page->getTemplateName(); } } $themeName = $theme->getThemeName(); $currentTheme = array("Theme" => $themeName, "Templates" => $templates); file_put_contents($themeStructureFile, json_encode($currentTheme)); }
/** * Defines the base method to generate a section * * @param \RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\PageTree\PageTree $pageTree * @param \RedKiteLabs\ThemeEngineBundle\Core\Theme\ThemeInterface $theme * @param array $options */ public function generateSection(PageTree $pageTree, ThemeInterface $theme, array $options) { // Writes page contentsSection $this->pageTree = $pageTree; $this->theme = $theme; $this->themeSlots = $theme->getThemeSlots(); $this->imagesSourcePath = $options["uploadAssetsAbsolutePath"]; $this->imagesTargetPath = $options["deployBundleAssetsPath"]; }
/** * Generates the template's subsections and the full template itself */ protected function generateBaseTemplate(PageTree $pageTree, ThemeInterface $theme, array $options) { $options["filter"] = array('site', 'language'); $this->twigTemplate = sprintf("{%% extends '%s:Theme:%s.html.twig' %%}" . PHP_EOL, $theme->getThemeName(), $this->template->getTemplateName()); $this->twigTemplate .= $this->contentSection->generateSection($pageTree, $theme, $options); return $this; }