function Media::shouldUpdateThumbnail

Same name in other branches
  1. 8.9.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::shouldUpdateThumbnail()
  2. 10 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::shouldUpdateThumbnail()
  3. 11.x 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 340

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.