protected function BaseUpdateRunner::setEntityRevision in Scheduled Updates 8
Set a entity to use a new revision is applicable.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity_to_update:
\Drupal\scheduled_updates\ScheduledUpdateInterface $update:
1 call to BaseUpdateRunner::setEntityRevision()
- BaseUpdateRunner::prepareEntityForUpdate in src/
Plugin/ BaseUpdateRunner.php - Prepare an entity to be updated.
File
- src/
Plugin/ BaseUpdateRunner.php, line 614 - Contains \Drupal\scheduled_updates\Plugin\BaseUpdateRunner.
Class
Namespace
Drupal\scheduled_updates\PluginCode
protected function setEntityRevision(ContentEntityInterface $entity_to_update, ScheduledUpdateInterface $update) {
if ($this->updateUtils
->isRevisionableUpdate($update)) {
$new_revision = FALSE;
$create_revisions = $this->configuration['create_revisions'];
if ($create_revisions == UpdateRunnerInterface::REVISIONS_BUNDLE_DEFAULT) {
$new_revision = $this->updateUtils
->getRevisionDefault($entity_to_update);
}
elseif ($create_revisions == UpdateRunnerInterface::REVISIONS_YES) {
$new_revision = TRUE;
}
$entity_to_update
->setNewRevision($new_revision);
if ($new_revision) {
$this->updateUtils
->setRevisionCreationTime($entity_to_update);
}
}
}