ContentEntityStorageBase::populateAffectedRevisionTranslations

protected ContentEntityStorageBase::populateAffectedRevisionTranslations(ContentEntityInterface $entity)

Populates the affected flag for all the revision translations.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: An entity object being saved.

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 534

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

protected function populateAffectedRevisionTranslations(ContentEntityInterface $entity) {
  if ($this->entityType->isTranslatable() && $this->entityType->isRevisionable()) {
    $languages = $entity->getTranslationLanguages();
    foreach ($languages as $langcode => $language) {
      $translation = $entity->getTranslation($langcode);
      // Avoid populating the value if it was already manually set.
      $affected = $translation->isRevisionTranslationAffected();
      if (!isset($affected) && $translation->hasTranslationChanges()) {
        $translation->setRevisionTranslationAffected(TRUE);
      }
    }
  }
}
doc_Drupal
2016-10-29 08:57:37
Comments
Leave a Comment

Please login to continue.