/**
  * Generate the content element
  */
 protected function compile()
 {
     $dataProvider = new StandardProvider(new Cache(), Client::getInstance());
     $factory = new Factory($dataProvider);
     $album = $factory->createAlbum($this->vimeo_albumId, true, $this->vimeo_sorting, $this->vimeo_sortingDirection);
     if ($album === null) {
         return;
     }
     $this->Template->setData($album->getData());
     $posterSize = deserialize($this->size, true);
     $videos = [];
     // Generate the videos
     /** @var Video $video */
     foreach ($album->getVideos() as $video) {
         // Set the images
         if (Config::get('vimeo_allImages') && ($images = $dataProvider->getVideoImages($video->getId())) !== null) {
             $video->setPicturesData($images);
         }
         $image = $dataProvider->getVideoImage($video->getId(), Config::get('vimeo_imageIndex'));
         // Set the poster
         if ($image !== null) {
             $video->setPoster($image);
         }
         $video->setPosterSize($posterSize);
         // Enable the lightbox
         if ($this->vimeo_lightbox) {
             $video->enableLightbox();
             // Enable the lightbox autoplay
             if ($this->vimeo_lightboxAutoplay) {
                 $video->enableLightboxAutoplay();
             }
         }
         $videos[] = $video->generate(new FrontendTemplate($this->vimeo_template));
     }
     $this->Template->videos = $videos;
 }
 /**
  * Get the video images
  *
  * @param int $videoId
  *
  * @return array|null
  */
 public function getVideoImages($videoId)
 {
     $videoId = (int) $videoId;
     $cacheKey = 'video_images_' . $videoId;
     if ($this->cache->isDataObsolete($cacheKey)) {
         if (($images = $this->fetchVideoImages($videoId)) === null) {
             return null;
         }
         $this->cache->setData('video_images_' . $videoId, $images);
     }
     return parent::getVideoImages($videoId);
 }
 /**
  * Get the video
  *
  * @return Video|null
  */
 protected function getVideo()
 {
     $dataProvider = new StandardProvider(new Cache(), Client::getInstance());
     $factory = new Factory($dataProvider);
     if (($video = $factory->createVideo($this->vimeo_videoId)) === null) {
         return null;
     }
     // Set the images
     if (Config::get('vimeo_allImages') && ($images = $dataProvider->getVideoImages($this->vimeo_videoId)) !== null) {
         $video->setPicturesData($images);
     }
     // Set the poster
     if (($image = $dataProvider->getVideoImage($this->vimeo_videoId, Config::get('vimeo_imageIndex'))) !== null) {
         $video->setPoster($image);
     }
     return $video;
 }