You are here

public function TranslatableRevisionableStorageInterface::createRevision in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/TranslatableRevisionableStorageInterface.php \Drupal\Core\Entity\TranslatableRevisionableStorageInterface::createRevision()
  2. 10 core/lib/Drupal/Core/Entity/TranslatableRevisionableStorageInterface.php \Drupal\Core\Entity\TranslatableRevisionableStorageInterface::createRevision()

Creates a new revision starting off from the specified entity object.

When dealing with a translatable entity, this will merge the default revision with the active translation of the passed entity.

Parameters

\Drupal\Core\Entity\RevisionableInterface $entity: The revisionable entity object being modified.

bool $default: (optional) Whether the new revision should be marked as default. Defaults to TRUE.

bool|null $keep_untranslatable_fields: (optional) Whether untranslatable field values should be kept or copied from the default revision when generating a merged revision. Defaults to TRUE if the provided entity is the default translation and untranslatable fields should only affect the default translation, FALSE otherwise.

Return value

\Drupal\Core\Entity\TranslatableRevisionableInterface A new translatable entity revision object.

Overrides RevisionableStorageInterface::createRevision

2 methods override TranslatableRevisionableStorageInterface::createRevision()
ContentEntityStorageBase::createRevision in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Creates a new revision starting off from the specified entity object.
KeyValueContentEntityStorage::createRevision in core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php
Creates a new revision starting off from the specified entity object.

File

core/lib/Drupal/Core/Entity/TranslatableRevisionableStorageInterface.php, line 30

Class

TranslatableRevisionableStorageInterface
A storage that supports translatable and revisionable entity types.

Namespace

Drupal\Core\Entity

Code

public function createRevision(RevisionableInterface $entity, $default = TRUE, $keep_untranslatable_fields = NULL);