function Media::getThumbnailUri
Same name in other branches
- 8.9.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getThumbnailUri()
- 10 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getThumbnailUri()
- 11.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getThumbnailUri()
Gets the URI for the thumbnail of a media item.
If thumbnail fetching is queued, new media items will use the default thumbnail, and existing media items will use the current thumbnail, until the queue is processed and the updated thumbnail has been fetched. Otherwise, the new thumbnail will be fetched immediately.
@internal
Parameters
bool $from_queue: Specifies whether the thumbnail is being fetched from the queue.
Return value
string The file URI for the thumbnail of the media item.
File
-
core/
modules/ media/ src/ Entity/ Media.php, line 250
Class
- Media
- Defines the media entity class.
Namespace
Drupal\media\EntityCode
protected function getThumbnailUri($from_queue) {
$thumbnails_queued = $this->bundle->entity
->thumbnailDownloadsAreQueued();
if ($thumbnails_queued && $this->isNew()) {
return $this->getDefaultThumbnailUri();
}
elseif ($thumbnails_queued && !$from_queue) {
return $this->get('thumbnail')->entity
->getFileUri();
}
$source = $this->getSource();
return $source->getMetadata($this, $source->getPluginDefinition()['thumbnail_uri_metadata_attribute']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.