function FieldTranslationSynchronizer::getOriginalEntity
Same name in other branches
- 8.9.x core/modules/content_translation/src/FieldTranslationSynchronizer.php \Drupal\content_translation\FieldTranslationSynchronizer::getOriginalEntity()
- 10 core/modules/content_translation/src/FieldTranslationSynchronizer.php \Drupal\content_translation\FieldTranslationSynchronizer::getOriginalEntity()
- 11.x core/modules/content_translation/src/FieldTranslationSynchronizer.php \Drupal\content_translation\FieldTranslationSynchronizer::getOriginalEntity()
Returns the original unchanged entity to be used to detect changes.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity being changed.
Return value
\Drupal\Core\Entity\ContentEntityInterface The unchanged entity.
1 call to FieldTranslationSynchronizer::getOriginalEntity()
- FieldTranslationSynchronizer::synchronizeFields in core/
modules/ content_translation/ src/ FieldTranslationSynchronizer.php - Performs field column synchronization on the given entity.
File
-
core/
modules/ content_translation/ src/ FieldTranslationSynchronizer.php, line 191
Class
- FieldTranslationSynchronizer
- Provides field translation synchronization capabilities.
Namespace
Drupal\content_translationCode
protected function getOriginalEntity(ContentEntityInterface $entity) {
if (!isset($entity->original)) {
$storage = $this->entityTypeManager
->getStorage($entity->getEntityTypeId());
$original = $entity->isDefaultRevision() ? $storage->loadUnchanged($entity->id()) : $storage->loadRevision($entity->getLoadedRevisionId());
}
else {
$original = $entity->original;
}
return $original;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.