function ContentEntityBase::isDefaultRevision

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::isDefaultRevision()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::isDefaultRevision()
  3. 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::isDefaultRevision()
2 calls to ContentEntityBase::isDefaultRevision()
MenuLinkContent::postSave in core/modules/menu_link_content/src/Entity/MenuLinkContent.php
Acts on a saved entity before the insert or update hook is invoked.
Node::postSave in core/modules/node/src/Entity/Node.php
Acts on a saved entity before the insert or update hook is invoked.

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function isDefaultRevision($new_value = NULL) {
    $return = $this->isDefaultRevision;
    if (isset($new_value)) {
        $this->isDefaultRevision = (bool) $new_value;
    }
    // New entities should always ensure at least one default revision exists,
    // creating an entity without a default revision is an invalid state.
    return $this->isNew() || $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.