You are here

public function ModerationInformation::getAffectedRevisionTranslation in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getAffectedRevisionTranslation()

Returns the revision translation affected translation of a revision.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The content entity.

Return value

\Drupal\Core\Entity\ContentEntityInterface The revision translation affected translation.

Overrides ModerationInformationInterface::getAffectedRevisionTranslation

File

core/modules/content_moderation/src/ModerationInformation.php, line 108

Class

ModerationInformation
General service for moderation-related questions about Entity API.

Namespace

Drupal\content_moderation

Code

public function getAffectedRevisionTranslation(ContentEntityInterface $entity) {
  foreach ($entity
    ->getTranslationLanguages() as $language) {
    $translation = $entity
      ->getTranslation($language
      ->getId());
    if (!$translation
      ->isDefaultRevision() && $translation
      ->isRevisionTranslationAffected()) {
      return $translation;
    }
  }
}