Ejemplo n.º 1
0
 /**
  * @param array   $content
  * @param string  $websiteId
  * @param string  $pageOrTemplateId
  * @param string  $mode
  * @param array   $currentItemInfo
  * @param string  $codeType
  * @param boolean $isTemplate
  */
 protected function renderWithNewRenderer(array &$content, $websiteId, $pageOrTemplateId, $mode, $currentItemInfo, $codeType, $isTemplate)
 {
     $websiteService = $this->getService('Website');
     $moduleService = $this->getService('Modul');
     $websiteSettingsService = $this->getService('WebsiteSettings');
     $websiteInfoStorage = new ServiceBasedWebsiteInfoStorage($websiteId, $websiteService, $websiteSettingsService);
     $moduleInfoStorage = new ServiceBasedModuleInfoStorage($websiteId, $moduleService);
     $colorInfoStorage = $this->getColorInfoStorage($websiteService, $websiteId);
     $resolutions = $this->getResolutions($websiteService, $websiteId);
     $navigationInfoStorage = $this->createNavigationInfoStorage($websiteId, $pageOrTemplateId, $isTemplate, $currentItemInfo, $this->createPageUrlHelper($websiteId, $pageOrTemplateId, $isTemplate, $mode));
     $usedMediaIds = $this->getMediaIdsFromContent($content);
     $mediaContext = $this->createMediaContext($websiteId, $usedMediaIds);
     $cacheImpl = $this->createCache($websiteId, $pageOrTemplateId);
     $renderContext = $this->createRenderContext($mode, $isTemplate, $resolutions, $websiteInfoStorage, $moduleInfoStorage, $mediaContext, $navigationInfoStorage, $colorInfoStorage, $cacheImpl);
     // Legacy Support (NOTE: this init NEEDS to be AFTER the init of all info storage and the new render context)
     LegacyRenderContext::init($renderContext, $websiteId, $pageOrTemplateId);
     $this->startNewRenderer($content, $moduleInfoStorage, $codeType, $renderContext);
 }
Ejemplo n.º 2
0
 protected function initLegacy()
 {
     // use the full path here, DO NOT convert this to use ...
     // if you do, it will fail in case of disabled legacy support
     // as the files are not copied to target server
     /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
     \Dual\Render\RenderContext::init($this->getRenderContext(), $this->pageMeta['websiteId'], $this->pageId);
 }
Ejemplo n.º 3
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;
 }