/** * Initializes the DataManager object from the database entities * * @param Language $language * @param Page $page */ public function fromEntities(Language $language = null, Page $page = null) { $this->language = $language; $this->page = $page; if (null !== $this->language && null !== $this->page) { $options = array("languageId" => $this->language->getId(), "pageId" => $this->page->getId()); $this->seo = $this->setupSeo($options); } }
/** * Generates the template's subsections and the full template itself */ protected function generatePageTemplate(PageTree $pageTree, ThemeInterface $theme, array $options) { if (!$this->page->getIsPublished()) { $this->twigTemplate = "{% extends 'RedKiteLabsThemeEngineBundle:Frontend:unpublished.html.twig' %}"; return $this; } $options["filter"] = array('page'); $this->twigTemplate = sprintf("{%% extends '%s:%s:%s/base/%s.html.twig' %%}" . PHP_EOL, $options["deployBundle"], $options["templatesDir"], $this->language->getLanguageName(), $this->page->getTemplateName()); $this->twigTemplate .= $this->metatagsSection->generateSection($pageTree, $theme, $options); $this->twigTemplate .= $this->assetsSection->generateSection($pageTree, $theme, $options); $this->twigTemplate .= $this->contentSection->generateSection($pageTree, $theme, $options); return $this; }
/** * Generates an internal route name, from the language and the page * * @param Language $language * @param Page $page * @return string */ protected function generateRoute(Language $language, Page $page) { return sprintf('_%s_%s', $language->getLanguageName(), str_replace("-", "_", $page->getPageName())); }