FieldTranslationSynchronizerInterface
interface FieldTranslationSynchronizerInterface (View source)
Provides field translation synchronization capabilities.
Methods
Performs field column synchronization on the given entity.
Synchronize the items of a single field.
Returns the synchronized properties for the specified field definition.
Details
synchronizeFields(ContentEntityInterface $entity, string $sync_langcode, string $original_langcode = NULL)
Performs field column synchronization on the given entity.
Field column synchronization takes care of propagating any change in the field items order and in the column values themselves to all the available translations. This functionality is provided by defining a 'translation_sync' key for the 'content_translation' module's portion of the field definition's 'third_party_settings', holding an array of column names to be synchronized. The synchronized column values are shared across translations, while the rest varies per-language. This is useful for instance to translate the "alt" and "title" textual elements of an image field, while keeping the same image on every translation.
synchronizeItems(array $field_values, array $unchanged_items, string $sync_langcode, array $translations, array $properties)
Synchronize the items of a single field.
All the column values of the "active" language are compared to the unchanged values to detect any addition, removal or change in the items order. Subsequently the detected changes are performed on the field items in other available languages.
string[]
getFieldSynchronizedProperties(FieldDefinitionInterface $field_definition)
Returns the synchronized properties for the specified field definition.