// Compare field item current values with the original ones to determine
// whether we have changes. If a field is not translatable and the entity is
// translated we skip it because, depending on the use case, it would make
// sense to mark all translations as changed or none of them. We skip also
// computed fields as comparing them with their original values might not be
// possible or be meaningless.
/** @var \Drupal\Core\Entity\ContentEntityBase $translation */
$translation =
$original->
getTranslation($this->activeLangcode
);
$langcode =
$this->
language()->
getId();
// The list of fields to skip from the comparison.
$skip_fields =
$this->
getFieldsToSkipFromTranslationChangesCheck();
// We also check untranslatable fields, so that a change to those will mark
// all translations as affected, unless they are configured to only affect
// the default translation.
$skip_untranslatable_fields = !
$this->
isDefaultTranslation() &&
$this->
isDefaultTranslationAffectedOnly();
foreach ($this->
getFieldDefinitions() as $field_name =>
$definition) { // @todo Avoid special-casing the following fields. See
// https://www.drupal.org/node/2329253.
if (in_array($field_name,
$skip_fields, TRUE
) || ($skip_untranslatable_fields && !
$definition->
isTranslatable())) { continue;
}