protected function ContentEntityStorageBase::populateAffectedRevisionTranslations in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::populateAffectedRevisionTranslations()
Populates the affected flag for all the revision translations.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: An entity object being saved.
1 call to ContentEntityStorageBase::populateAffectedRevisionTranslations()
- ContentEntityStorageBase::doSave in core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php - Performs storage-specific saving of the entity.
File
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php, line 916
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\EntityCode
protected function populateAffectedRevisionTranslations(ContentEntityInterface $entity) {
if ($this->entityType
->isTranslatable() && $this->entityType
->isRevisionable()) {
$languages = $entity
->getTranslationLanguages();
foreach ($languages as $langcode => $language) {
$translation = $entity
->getTranslation($langcode);
$current_affected = $translation
->isRevisionTranslationAffected();
if (!isset($current_affected) || $entity
->isNewRevision() && !$translation
->isRevisionTranslationAffectedEnforced()) {
// When setting the revision translation affected flag we have to
// explicitly set it to not be enforced. By default it will be
// enforced automatically when being set, which allows us to determine
// if the flag has been already set outside the storage in which case
// we should not recompute it.
// @see \Drupal\Core\Entity\ContentEntityBase::setRevisionTranslationAffected().
$new_affected = $translation
->hasTranslationChanges() ? TRUE : NULL;
$translation
->setRevisionTranslationAffected($new_affected);
$translation
->setRevisionTranslationAffectedEnforced(FALSE);
}
}
}
}