protected function RevisionableContentEntityForm::prepareEntity in Entity API 8.0
Same name and namespace in other branches
- 8 src/Form/RevisionableContentEntityForm.php \Drupal\entity\Form\RevisionableContentEntityForm::prepareEntity()
Prepares the entity object before the form is built first.
Overrides ContentEntityForm::prepareEntity
File
- src/
Form/ RevisionableContentEntityForm.php, line 29 - Contains \Drupal\entity\Form\RevisionableContentEntityForm.
Class
- RevisionableContentEntityForm
- Extends the base entity form with revision support in the UI.
Namespace
Drupal\entity\FormCode
protected function prepareEntity() {
parent::prepareEntity();
$bundle_entity = $this
->getBundleEntity();
// Set up default values, if required.
if (!$this->entity
->isNew()) {
$this->entity
->setRevisionLogMessage(NULL);
}
if ($bundle_entity instanceof RevisionableEntityBundleInterface) {
// Always use the default revision setting.
$this->entity
->setNewRevision($bundle_entity && $bundle_entity
->shouldCreateNewRevision());
}
}