You are here

public function Pinterest::thumbnail in Media entity Pinterest 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

File

src/Plugin/MediaEntity/Type/Pinterest.php, line 221

Class

Pinterest
Provides media type plugin for Pinterest.

Namespace

Drupal\media_entity_pinterest\Plugin\MediaEntity\Type

Code

public function thumbnail(MediaInterface $media) {
  if ($local_image = $this
    ->getField($media, 'thumbnail_local')) {
    return $local_image;
  }
  return $this
    ->getDefaultThumbnail();
}