/**
  * Rebuild the cache and return true on success, false otherwise
  *
  * @param ProviderInterface $dataProvider
  * @param ContentModel      $contentElement
  *
  * @return bool
  */
 public function rebuild(ProviderInterface $dataProvider, ContentModel $contentElement)
 {
     $factory = new Factory($dataProvider);
     if (($video = $factory->createVideo($contentElement->vimeo_videoId)) === null) {
         return false;
     }
     if (Config::get('vimeo_allImages') && $dataProvider->getVideoImages($contentElement->vimeo_videoId) === null) {
         return false;
     }
     if ($dataProvider->getVideoImage($contentElement->vimeo_videoId, Config::get('vimeo_imageIndex')) === null) {
         return false;
     }
     return true;
 }
 /**
  * Rebuild the cache and return true on success, false otherwise
  *
  * @param ProviderInterface $dataProvider
  * @param ContentModel      $contentElement
  *
  * @return bool
  */
 public function rebuild(ProviderInterface $dataProvider, ContentModel $contentElement)
 {
     $factory = new Factory($dataProvider);
     $album = $factory->createAlbum($contentElement->vimeo_albumId, true, $contentElement->vimeo_sorting, $contentElement->vimeo_sortingDirection);
     if ($album === null) {
         return false;
     }
     /** @var Video $video */
     foreach ($album->getVideos() as $video) {
         if (Config::get('vimeo_allImages') && $dataProvider->getVideoImages($video->getId()) === null) {
             return false;
         }
         if ($dataProvider->getVideoImage($video->getId(), Config::get('vimeo_imageIndex')) === null) {
             return false;
         }
     }
     return true;
 }
 /**
  * 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
  *
  * @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;
 }