Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Media.php

function 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 269

Class

Media
Defines the media entity class.

Namespace

Drupal\media\Entity

Code

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']);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal