예제 #1
0
 private function initPageTree(Language $language, Page $page = null, Template $template = null)
 {
     $dataManager = new DataManager($this->factoryRepository);
     $dataManager->fromEntities($language, $page);
     $pageBlocks = clone $this->pageBlocks;
     if (null !== $page) {
         $pageBlocks->refresh($language->getId(), $page->getId());
     }
     $assetsManager = clone $this->assetsManager;
     $assetsManager->setPageBlocks($pageBlocks);
     $pageTree = new PageTree($assetsManager, null, $dataManager);
     $pageTree->productionMode(true)->setUp($this->theme, clone $this->templateManager, $pageBlocks, $template);
     return $pageTree;
 }
 /**
  * Normalizes the request attributes for page, language and permalink for a
  * GET request
  *
  * This method normalizes RedKite CMS parameters, injecting all the attributes
  * required to define a page.
  *
  * When a page is requested by the language and page name attributes, the permalink attribute is
  * filled up, while a page is requested by permalink, the language and page name are filled up to.
  *
  * @param Request $request
  * @param DataManager $dataManager
  */
 private function normalizeCmsRequestAttributes(Request $request, DataManager $dataManager)
 {
     if ($request->getMethod() == 'POST') {
         return;
     }
     $page = $dataManager->getPage();
     if (null !== $page) {
         $request->attributes->set('page', $page->getPageName());
     }
     $language = $dataManager->getLanguage();
     if (null !== $language) {
         $request->attributes->set('_locale', $language->getLanguageName());
     }
     $seo = $dataManager->getSeo();
     if (null !== $seo) {
         $request->attributes->set('permalink', $seo->getPermalink());
     }
 }