Ejemplo n.º 1
0
 /**
  * @param BlockInterface $block
  */
 public function load(BlockInterface $block)
 {
     $levels = isset($block->getProperties()['levels']) ? $block->getProperties()['levels'] : 1;
     /** @var NavigationBlock $block */
     if ($block->getValue() == NavigationBlock::CHOICE_CUSTOM && isset($block->getProperties()['content'])) {
         $ids = json_decode($block->getProperties()['content'], true);
         $collection = $this->contentManager->getRepository()->findOrderedByIds($ids);
         $block->setTree($collection);
     } elseif ($block->getValue() == NavigationBlock::CHOICE_TOP_LEVEL) {
         $collection = $this->contentManager->getRepository()->findByLevels($levels);
         $block->setTree($collection);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param BlockInterface $block
  */
 public function load(BlockInterface $block)
 {
     $collection = $this->contentManager->getRepository()->findOrderedByIds(json_decode($block->getValue()));
     if ($collection) {
         $block->setCollection($collection);
     }
 }
Ejemplo n.º 3
0
 /**
  * @param BlockInterface $block
  */
 public function load(BlockInterface $block)
 {
     $collection = $this->contentManager->getRepository()->createQueryBuilder('c')->where('c.id IN (:ids)')->setParameter('ids', json_decode($block->getValue()))->getQuery()->getResult();
     if ($collection) {
         $block->setCollection($collection);
     }
 }
Ejemplo n.º 4
0
 /**
  * @param BlockInterface $block
  */
 public function load(BlockInterface $block)
 {
     $gallery = $this->mediaManager->getRepository()->findByIds(json_decode($block->getValue()));
     if ($gallery) {
         $block->setGallery($gallery);
     }
 }
Ejemplo n.º 5
0
 /**
  * @param BlockInterface $block
  */
 public function load(BlockInterface $block)
 {
     $ids = json_decode($block->getValue());
     if (empty($ids) || !count($ids)) {
         return;
     }
     $gallery = $this->mediaManager->getRepository()->findByIds($ids);
     uasort($gallery, function ($a, $b) use($ids) {
         return array_search($a->getId(), $ids) > array_search($b->getId(), $ids);
     });
     if ($gallery) {
         $block->setGallery(new ArrayCollection($gallery));
     }
 }
 /**
  * @param BlockInterface $block
  */
 public function load(BlockInterface $block)
 {
     /** @var NavigationBlock $block */
     $block->setTree($this->GetTree($block->getValue()));
 }