You are here

public function VideoEmbedField::thumbnail in Video Embed Field 8

Gets thumbnail image.

Media type plugin is responsible for returning URI of the generic thumbnail if no other is available. This functions should always return a valid URI.

Parameters

MediaInterface $media: Media.

Return value

string URI of the thumbnail.

Overrides MediaTypeInterface::thumbnail

1 call to VideoEmbedField::thumbnail()
VideoEmbedField::getField in modules/video_embed_media/src/Plugin/MediaEntity/Type/VideoEmbedField.php
Gets a media-related field/value.

File

modules/video_embed_media/src/Plugin/MediaEntity/Type/VideoEmbedField.php, line 74

Class

VideoEmbedField
Provides media type plugin for video embed field.

Namespace

Drupal\video_embed_media\Plugin\MediaEntity\Type

Code

public function thumbnail(MediaInterface $media) {
  if ($provider = $this
    ->loadProvider($media)) {
    $provider
      ->downloadThumbnail();
    return $provider
      ->getLocalThumbnailUri();
  }
  return $this
    ->getDefaultThumbnail();
}