W3cubDocs

/Drupal 8

protected function 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 527

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);
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!ContentEntityStorageBase.php/function/ContentEntityStorageBase::populateAffectedRevisionTranslations/8.1.x