/**
  * @param PageBlockInterface $block
  * @param array              $options
  *
  * @return string
  */
 public function renderBlock(PageBlockInterface $block, array $options = array())
 {
     if ($block->getEnabled() === false && !$this->cmsManagerSelector->isEditor()) {
         return '';
     }
     // defined extra default key for the cache
     $pageCacheKeys = array('manager' => $block->getPage() instanceof SnapshotPageProxy ? 'snapshot' : 'page', 'page_id' => $block->getPage()->getId());
     // build the parameters array
     $options = array_merge(array('use_cache' => isset($options['use_cache']) ? $options['use_cache'] : true, 'extra_cache_keys' => array()), $pageCacheKeys, $options);
     // make sure the parameters array contains all valid keys
     $options['extra_cache_keys'] = array_merge($options['extra_cache_keys'], $pageCacheKeys);
     return $this->blockHelper->render($block, $options);
 }
Exemple #2
0
 /**
  * Add blocs
  *
  * @param PageBlockInterface $blocs
  */
 public function addBlocks(PageBlockInterface $blocs)
 {
     $blocs->setPage($this);
     $this->blocks[] = $blocs;
 }
 /**
  * Add block
  *
  * @param \Symbio\OrangeGate\PageBundle\Entity\Block $block
  * @return Page
  */
 public function addBlock(PageBlockInterface $block)
 {
     $block->setPage($this);
     $this->blocks[] = $block;
     return $this;
 }