Ejemplo n.º 1
0
 /**
  * @param PreparePageResult $preparePageResult
  */
 protected function addPageToStorage(PreparePageResult $preparePageResult)
 {
     $storage = $this->getCreatorStorage();
     if ($preparePageResult->getLegacySupport()) {
         $storage->addLegacyPage($preparePageResult->getPageId(), $preparePageResult->getPageMeta(), $preparePageResult->getPageGlobal(), $preparePageResult->getPageAttributes(), $preparePageResult->getPageContent(), $preparePageResult->getCssCacheValue());
     } else {
         $storage->addPage($preparePageResult->getPageId(), $preparePageResult->getPageMeta(), $preparePageResult->getPageGlobal(), $preparePageResult->getPageAttributes(), $preparePageResult->getPageContent(), $preparePageResult->getCssCacheValue());
     }
 }
Ejemplo n.º 2
0
 /**
  * Render Context suitable for usage in the creator
  * (e.g. use Service as data backend, but generate URLs for usage in live page)
  *
  * @param string        $websiteId
  * @param string        $currentPageId
  * @param SiteStructure $structure
  *
  * @param               $relativePathToWebRoot
  *
  * @return \Render\RenderContext
  */
 protected function createRenderContext($websiteId, $currentPageId, $structure, $relativePathToWebRoot)
 {
     $websiteInfoStorage = $this->getCreatorContext()->getWebsiteInfoStorage($websiteId);
     $moduleInfoStorage = $this->getCreatorContext()->createCreatorModuleInfoStorage($websiteId, $relativePathToWebRoot);
     $navUrlHelper = new SiteStructurePageUrlHelper($structure, $currentPageId, $relativePathToWebRoot);
     $navigationInfoStorage = $this->getCreatorContext()->getNavigationInfoStorage($websiteId, $currentPageId, $navUrlHelper);
     $colorInfoStorage = $this->getCreatorContext()->getColorInfoStorage($websiteId);
     // media context
     $mediaContext = new MediaContext($this->getCreatorContext()->createMediaInfoStorage($websiteId, $this->createInterceptorMediaUrlHelper($relativePathToWebRoot)), $this->getCreatorContext()->getImageToolFactory());
     $interfaceLocaleCode = 'en_EN';
     $renderMode = RenderContext::RENDER_MODE_CREATOR;
     $renderType = RenderContext::RENDER_TYPE_PAGE;
     $resolutions = $this->getCreatorContext()->getResolutions($websiteId);
     $renderContext = new RenderContext($websiteInfoStorage, $moduleInfoStorage, $navigationInfoStorage, $colorInfoStorage, $mediaContext, $interfaceLocaleCode, $renderMode, $renderType, $resolutions);
     // TODO: add cache here?
     // init legacy if required
     if ($this->result->getLegacySupport()) {
         LegacyRenderContext::init($renderContext, $websiteId, $currentPageId);
     }
     return $renderContext;
 }