function ContentEntityForm::getNewRevisionDefault

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getNewRevisionDefault()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getNewRevisionDefault()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getNewRevisionDefault()

Should new revisions created on default.

Return value

bool New revision on default.

1 call to ContentEntityForm::getNewRevisionDefault()
ContentEntityForm::addRevisionableFormFields in core/lib/Drupal/Core/Entity/ContentEntityForm.php
Add revision form fields if the entity enabled the UI.

File

core/lib/Drupal/Core/Entity/ContentEntityForm.php, line 462

Class

ContentEntityForm
Entity form variant for content entity types.

Namespace

Drupal\Core\Entity

Code

protected function getNewRevisionDefault() {
    $new_revision_default = FALSE;
    $bundle_entity = $this->getBundleEntity();
    if ($bundle_entity instanceof RevisionableEntityBundleInterface) {
        // Always use the default revision setting.
        $new_revision_default = $bundle_entity->shouldCreateNewRevision();
    }
    return $new_revision_default;
}

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