function Media::getThumbnailWidth
Same name in other branches
- 9 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getThumbnailWidth()
- 11.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getThumbnailWidth()
Gets the width of the thumbnail of a media item.
@internal
Parameters
bool $from_queue: Specifies whether the thumbnail is being fetched from the queue.
Return value
int|null The width of the thumbnail of the media item or NULL if the media is new and the thumbnails are set to be downloaded in a queue.
1 call to Media::getThumbnailWidth()
- Media::updateThumbnail in core/
modules/ media/ src/ Entity/ Media.php - Update the thumbnail for the media item.
File
-
core/
modules/ media/ src/ Entity/ Media.php, line 281
Class
- Media
- Defines the media entity class.
Namespace
Drupal\media\EntityCode
protected function getThumbnailWidth(bool $from_queue) : ?int {
$thumbnails_queued = $this->bundle->entity
->thumbnailDownloadsAreQueued();
if ($thumbnails_queued && $this->isNew()) {
return NULL;
}
elseif ($thumbnails_queued && !$from_queue) {
return $this->get('thumbnail')->width;
}
$source = $this->getSource();
return $source->getMetadata($this, $source->getPluginDefinition()['thumbnail_width_metadata_attribute']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.