Backup of db before drupal security update
[yaffs-website] / web / core / modules / content_translation / src / FieldTranslationSynchronizerInterface.php
1 <?php
2
3 namespace Drupal\content_translation;
4
5 use Drupal\Core\Entity\ContentEntityInterface;
6
7 /**
8  * Provides field translation synchronization capabilities.
9  */
10 interface FieldTranslationSynchronizerInterface {
11
12   /**
13    * Performs field column synchronization on the given entity.
14    *
15    * Field column synchronization takes care of propagating any change in the
16    * field items order and in the column values themselves to all the available
17    * translations. This functionality is provided by defining a
18    * 'translation_sync' key for the 'content_translation' module's portion of
19    * the field definition's 'third_party_settings', holding an array of
20    * column names to be synchronized. The synchronized column values are shared
21    * across translations, while the rest varies per-language. This is useful for
22    * instance to translate the "alt" and "title" textual elements of an image
23    * field, while keeping the same image on every translation.
24    *
25    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
26    *   The entity whose values should be synchronized.
27    * @param string $sync_langcode
28    *   The language of the translation whose values should be used as source for
29    *   synchronization.
30    * @param string $original_langcode
31    *   (optional) If a new translation is being created, this should be the
32    *   language code of the original values. Defaults to NULL.
33    */
34   public function synchronizeFields(ContentEntityInterface $entity, $sync_langcode, $original_langcode = NULL);
35
36   /**
37    * Synchronize the items of a single field.
38    *
39    * All the column values of the "active" language are compared to the
40    * unchanged values to detect any addition, removal or change in the items
41    * order. Subsequently the detected changes are performed on the field items
42    * in other available languages.
43    *
44    * @param array $field_values
45    *   The field values to be synchronized.
46    * @param array $unchanged_items
47    *   The unchanged items to be used to detect changes.
48    * @param string $sync_langcode
49    *   The language code of the items to use as source values.
50    * @param array $translations
51    *   An array of all the available language codes for the given field.
52    * @param array $columns
53    *   An array of column names to be synchronized.
54    */
55   public function synchronizeItems(array &$field_values, array $unchanged_items, $sync_langcode, array $translations, array $columns);
56
57 }