function ModerationInformation::getAffectedRevisionTranslation

Same name in other branches
  1. 9 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getAffectedRevisionTranslation()
  2. 10 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getAffectedRevisionTranslation()
  3. 11.x core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getAffectedRevisionTranslation()

Overrides ModerationInformationInterface::getAffectedRevisionTranslation

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.