Пример #1
0
 /**
  * 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));
 }
Пример #2
0
 /**
  * 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;
 }