You are here

public function ContentEntityBase::isNewRevision in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::isNewRevision()

Determines whether a new revision should be created on save.

Return value

bool TRUE if a new revision should be created.

Overrides RevisionableInterface::isNewRevision

See also

\Drupal\Core\Entity\EntityInterface::setNewRevision()

3 calls to ContentEntityBase::isNewRevision()
BlockContent::preSaveRevision in core/modules/block_content/src/Entity/BlockContent.php
Acts on a revision before it gets saved.
Media::preSaveRevision in core/modules/media/src/Entity/Media.php
Acts on a revision before it gets saved.
Node::preSaveRevision in core/modules/node/src/Entity/Node.php
Acts on a revision before it gets saved.

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 328

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function isNewRevision() {
  return $this->newRevision || $this
    ->getEntityType()
    ->hasKey('revision') && !$this
    ->getRevisionId();
}