BlockContent::preSaveRevision

public BlockContent::preSaveRevision(EntityStorageInterface $storage, \stdClass $record)

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 129

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->getRevisionLogMessage();
  }
}
doc_Drupal
2016-10-29 08:46:45
Comments
Leave a Comment

Please login to continue.