function Media::hasSourceFieldChanged

Same name in other branches
  1. 9 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::hasSourceFieldChanged()
  2. 8.9.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::hasSourceFieldChanged()
  3. 10 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::hasSourceFieldChanged()

Determines if the source field value has changed.

The comparison uses MediaSourceInterface::getSourceFieldValue() to ensure that the correct property from the source field is used.

@internal

Return value

bool TRUE if the source field value changed, FALSE otherwise.

See also

\Drupal\media\MediaSourceInterface::getSourceFieldValue()

1 call to Media::hasSourceFieldChanged()
Media::shouldUpdateThumbnail in core/modules/media/src/Entity/Media.php
Determines if the thumbnail should be updated for a media item.

File

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

Class

Media
Defines the media entity class.

Namespace

Drupal\media\Entity

Code

protected function hasSourceFieldChanged() {
    $source = $this->getSource();
    return isset($this->original) && $source->getSourceFieldValue($this) !== $source->getSourceFieldValue($this->original);
}

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