/** * Changes the website templates with the new ones provided into the $templatesMap * array * * @param ThemeInterface $theme * @param array $templatesMap * @throws \Exception */ protected function changeTemplate(ThemeInterface $theme, array $templatesMap) { $ignoreRepeatedSlots = false; foreach ($this->languagesRepository->activeLanguages() as $language) { foreach ($this->pagesRepository->activePages() as $page) { $templateName = $page->getTemplateName(); if (!array_key_exists($templateName, $templatesMap)) { continue; } $page->setTemplateName($templatesMap[$templateName]); $page->save(); $template = $theme->getTemplate($page->getTemplateName()); $this->templateManager->refresh($theme->getThemeSlots(), $template); $this->templateManager->populate($language->getId(), $page->getId(), $ignoreRepeatedSlots); $ignoreRepeatedSlots = true; } } }
/** * 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"]; }