function Media::preSaveRevision
Same name in other branches
- 9 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::preSaveRevision()
- 8.9.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::preSaveRevision()
- 11.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::preSaveRevision()
Overrides ContentEntityBase::preSaveRevision
File
-
core/
modules/ media/ src/ Entity/ Media.php, line 387
Class
- Media
- Defines the media entity class.
Namespace
Drupal\media\EntityCode
public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
parent::preSaveRevision($storage, $record);
if (!$this->isNewRevision() && isset($this->original) && empty($record->revision_log_message)) {
// If we are updating an existing media item without adding a
// new revision, we need to make sure $entity->revision_log_message is
// reset whenever it is empty.
// Therefore, this code allows us to avoid clobbering an existing log
// entry with an empty one.
$this->setRevisionLogMessage($this->original
->getRevisionLogMessage());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.