You are here

public function BlockContent::preSaveRevision in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::preSaveRevision()

Acts on a revision before it gets saved.

Parameters

EntityStorageInterface $storage: The entity storage object.

\stdClass $record: The revision object.

Overrides ContentEntityBase::preSaveRevision

File

core/modules/block_content/src/Entity/BlockContent.php, line 127
Contains \Drupal\block_content\Entity\BlockContent.

Class

BlockContent
Defines the custom block entity class.

Namespace

Drupal\block_content\Entity

Code

public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
  parent::preSaveRevision($storage, $record);
  if (!$this
    ->isNewRevision() && isset($this->original) && (!isset($record->revision_log) || $record->revision_log === '')) {

    // If we are updating an existing block_content without adding a new
    // revision and the user did not supply a revision log, keep the existing
    // one.
    $record->revision_log = $this->original
      ->getRevisionLog();
  }
}