You are here

protected function ContentEntityStorageBase::populateAffectedRevisionTranslations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 517
Contains \Drupal\Core\Entity\ContentEntityStorageBase.

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