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

Breadcrumb

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

function Media::shouldUpdateThumbnail

Determines if the thumbnail should be updated for a media item.

Parameters

bool $is_new: Specifies whether the media item is new.

Return value

bool TRUE if the thumbnail should be updated, FALSE otherwise.

File

core/modules/media/src/Entity/Media.php, line 359

Class

Media
Defines the media entity class.

Namespace

Drupal\media\Entity

Code

protected function shouldUpdateThumbnail($is_new = FALSE) {
    // Update thumbnail if we don't have a thumbnail yet or when the source
    // field value changes.
    return !$this->get('thumbnail')->entity || $is_new || $this->hasSourceFieldChanged();
}
RSS feed
Powered by Drupal