// untranslatable fields affect only the default translation, in which case
// a pending revision contains only one affected translation. Even in this
// case, multiple translations would be affected in a single revision, if we
// allowed changes to untranslatable fields while editing non-default
// translations, so that is forbidden too. For the same reason, when changes
// to untranslatable fields affect all translations, we can only allow them
// in default revisions.
if ($this->
hasUntranslatableFieldsChanges($entity)) { if ($entity->
isDefaultTranslationAffectedOnly()) { foreach ($entity->
getTranslationLanguages(FALSE
) as $langcode =>
$language) { if ($entity->
getTranslation($langcode)->
hasTranslationChanges()) { $this->context->
addViolation($constraint->defaultTranslationMessage
);
break;
} } } else { $this->context->
addViolation($constraint->defaultRevisionMessage
);
} } } /**
* Checks whether an entity has untranslatable field changes.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* A content entity object.
*
* @return bool
* TRUE if untranslatable fields have changes, FALSE otherwise.
*/