You are here

protected function VideoExtendedFormatter::getPoster in Media Thumbnails Video 8

Get poster.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Entity object.

Return value

bool|string Url to poster or false.

1 call to VideoExtendedFormatter::getPoster()
VideoExtendedFormatter::viewElements in src/Plugin/Field/FieldFormatter/VideoExtendedFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/VideoExtendedFormatter.php, line 54

Class

VideoExtendedFormatter
Plugin implementation of the 'file_video' formatter.

Namespace

Drupal\media_thumbnails_video\Plugin\Field\FieldFormatter

Code

protected function getPoster(EntityInterface $entity) {
  if ($entity instanceof MediaInterface) {
    $thumbnail = $entity
      ->get('thumbnail')->entity;
    if ($thumbnail) {
      $url = file_create_url($thumbnail
        ->getFileUri());
      return $url;
    }
  }
  return FALSE;
}