You are here

protected function Media::shouldUpdateThumbnail in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::shouldUpdateThumbnail()
  2. 9 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\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 288

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();
}