} /** @var \Drupal\Core\Field\FieldItemListInterface $items */
foreach ($entity as $field_name =>
$items) { $field_definition =
$items->
getFieldDefinition();
$field_type_definition =
$this->fieldTypeManager->
getDefinition($field_definition->
getType());
$column_groups =
$field_type_definition['column_groups'
];
// Sync if the field is translatable, not empty, and the synchronization
// setting is enabled.
if (($translation_sync =
$this->
getFieldSynchronizationSettings($field_definition)) && !
$items->
isEmpty()) { // Retrieve all the untranslatable column groups and merge them into
// single list.
$groups =
array_keys(array_diff($translation_sync,
array_filter($translation_sync)));
// If a group was selected has the require_all_groups_for_translation
// flag set, there are no untranslatable columns. This is done because
// the UI adds JavaScript that disables the other checkboxes, so their
// values are not saved.
foreach (array_filter($translation_sync) as $group) { if (!
empty($column_groups[$group]['require_all_groups_for_translation'
])) { $groups =
[];