Example #1
0
 public function getPlaceHolderSet()
 {
     if ($this->placeHolderSet) {
         return $this->placeHolderSet;
     }
     parent::getPlaceHolderSet();
     $this->createMissingPlaceHolders();
     return $this->placeHolderSet;
 }
Example #2
0
 /**
  * Iteration function for specific array of blocks.
  * 
  * @param \Closure $function
  * @return array
  */
 private function iterateBlocks(\Closure $function)
 {
     $return = array();
     foreach ($this->pageRequest->getBlockSet() as $index => $block) {
         /* @var $block Block */
         $blockId = $block->getId();
         /* @var $blockController BlockController */
         if (!isset($this->blockControllers[$blockId])) {
             $this->blockControllers[$blockId] = null;
         }
         $blockController =& $this->blockControllers[$blockId];
         $return[$index] = $function($block, $blockController);
         // NB! Block controller variable might be rewritten in the function
         if ($blockController instanceof BlockController && $blockController->hadException()) {
             $this->container->getLogger()->error(sprintf('Block controller throwed an exception [%s].', $blockController->getException()->getMessage()));
             // Don't cache failed blocks
             unset($this->blockCacheRequests[$blockId]);
         }
     }
     return $return;
 }
Example #3
0
 /**
  * @return PageSet
  */
 public function getPageSet()
 {
     if ($this->pageSet === null) {
         $auditReader = $this->getAuditReader();
         $localization = $this->getLocalization();
         //			$auditReader->getCache()->setSuffix($localization->getPublishedRevision());
         $entityManager = $this->getEntityManager();
         $pages = array();
         foreach (parent::getPageSet() as $page) {
             $revisionId = $localization->getPublishedRevision();
             if ($page instanceof Template) {
                 $templateLocalization = $page->getLocalization($localization->getLocaleId());
                 if ($templateLocalization === null) {
                     throw new \RuntimeException(sprintf('Template [%s] from page structure set has no localization for [%s] locale.', $page->getId(), $localization->getLocaleId()));
                 }
                 $revisions = $auditReader->findRevisions(TemplateLocalization::CN(), $templateLocalization->getId());
                 $lastRevision = array_shift($revisions);
                 $revisionId = $lastRevision->getRev();
             }
             $classMetadata = $entityManager->getClassMetadata($page::CN());
             $pages[] = $auditReader->find($classMetadata->name, $page->getId(), $revisionId);
         }
         $this->pageSet = new PageSet($pages);
     }
     return $this->pageSet;
 }