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

Breadcrumb

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

function Media::getThumbnailHeight

Gets the height 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 height 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::getThumbnailHeight()
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 319

Class

Media
Defines the media entity class.

Namespace

Drupal\media\Entity

Code

protected function getThumbnailHeight(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')->height;
    }
    $source = $this->getSource();
    return $source->getMetadata($this, $source->getPluginDefinition()['thumbnail_height_metadata_attribute']);
}

API Navigation

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