function Media::preSave
Same name in other branches
- 9 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::preSave()
- 8.9.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::preSave()
- 10 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::preSave()
Overrides ContentEntityBase::preSave
File
-
core/
modules/ media/ src/ Entity/ Media.php, line 355
Class
- Media
- Defines the media entity class.
Namespace
Drupal\media\EntityCode
public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
if (!$this->getOwner()) {
$this->setOwnerId(0);
}
// If no thumbnail has been explicitly set, use the default thumbnail.
if ($this->get('thumbnail')
->isEmpty()) {
$this->thumbnail->target_id = $this->loadThumbnail()
->id();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.