if (!
empty($columns)) { $values =
[];
foreach ($translations as $langcode =>
$language) { $values[$langcode] =
$entity->
getTranslation($langcode)->
get($field_name)->
getValue();
} // If a translation is being created, the original values should be
// used as the unchanged items. In fact there are no unchanged items
// to check against.
$langcode =
$original_langcode ?:
$sync_langcode;
$unchanged_items =
$entity_unchanged->
getTranslation($langcode)->
get($field_name)->
getValue();
$this->
synchronizeItems($values,
$unchanged_items,
$sync_langcode,
array_keys($translations),
$columns);
foreach ($translations as $langcode =>
$language) { $entity->
getTranslation($langcode)->
get($field_name)->
setValue($values[$langcode]);
} } } } } } /**
* Returns the original unchanged entity to be used to detect changes.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The entity being changed.
*
* @return \Drupal\Core\Entity\ContentEntityInterface
* The unchanged entity.
*/