Ejemplo n.º 1
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.º 2
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));
     }
 }