You are here

public function FieldTranslationSynchronizerInterface::synchronizeFields in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/content_translation/src/FieldTranslationSynchronizerInterface.php \Drupal\content_translation\FieldTranslationSynchronizerInterface::synchronizeFields()

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.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity whose values should be synchronized.

string $sync_langcode: The language of the translation whose values should be used as source for synchronization.

string $original_langcode: (optional) If a new translation is being created, this should be the language code of the original values. Defaults to NULL.

1 method overrides FieldTranslationSynchronizerInterface::synchronizeFields()
FieldTranslationSynchronizer::synchronizeFields in core/modules/content_translation/src/FieldTranslationSynchronizer.php
Performs field column synchronization on the given entity.

File

core/modules/content_translation/src/FieldTranslationSynchronizerInterface.php, line 35

Class

FieldTranslationSynchronizerInterface
Provides field translation synchronization capabilities.

Namespace

Drupal\content_translation

Code

public function synchronizeFields(ContentEntityInterface $entity, $sync_langcode, $original_langcode = NULL);