function ContentEntityBase::wasDefaultRevision
Checks whether the entity object was a default revision when it was saved.
Return value
bool TRUE if the entity object was a revision, FALSE otherwise.
Overrides RevisionableInterface::wasDefaultRevision
File
-
core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php, line 360
Class
- ContentEntityBase
- Implements Entity Field API specific enhancements to the Entity class.
Namespace
Drupal\Core\EntityCode
public function wasDefaultRevision() {
/** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */
$entity_type = $this->getEntityType();
if (!$entity_type->isRevisionable()) {
return TRUE;
}
$revision_default_key = $entity_type->getRevisionMetadataKey('revision_default');
$value = $this->isNew() || $this->get($revision_default_key)->value;
return $value;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.