Updated Drupal to 8.6. This goes with the following updates because it's possible...
[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 use Drupal\Core\Field\FieldDefinitionInterface;
7
8 /**
9  * Provides field translation synchronization capabilities.
10  */
11 interface FieldTranslationSynchronizerInterface {
12
13   /**
14    * Performs field column synchronization on the given entity.
15    *
16    * Field column synchronization takes care of propagating any change in the
17    * field items order and in the column values themselves to all the available
18    * translations. This functionality is provided by defining a
19    * 'translation_sync' key for the 'content_translation' module's portion of
20    * the field definition's 'third_party_settings', holding an array of
21    * column names to be synchronized. The synchronized column values are shared
22    * across translations, while the rest varies per-language. This is useful for
23    * instance to translate the "alt" and "title" textual elements of an image
24    * field, while keeping the same image on every translation.
25    *
26    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
27    *   The entity whose values should be synchronized.
28    * @param string $sync_langcode
29    *   The language of the translation whose values should be used as source for
30    *   synchronization.
31    * @param string $original_langcode
32    *   (optional) If a new translation is being created, this should be the
33    *   language code of the original values. Defaults to NULL.
34    */
35   public function synchronizeFields(ContentEntityInterface $entity, $sync_langcode, $original_langcode = NULL);
36
37   /**
38    * Synchronize the items of a single field.
39    *
40    * All the column values of the "active" language are compared to the
41    * unchanged values to detect any addition, removal or change in the items
42    * order. Subsequently the detected changes are performed on the field items
43    * in other available languages.
44    *
45    * @param array $field_values
46    *   The field values to be synchronized.
47    * @param array $unchanged_items
48    *   The unchanged items to be used to detect changes.
49    * @param string $sync_langcode
50    *   The language code of the items to use as source values.
51    * @param array $translations
52    *   An array of all the available language codes for the given field.
53    * @param array $properties
54    *   An array of property names to be synchronized.
55    */
56   public function synchronizeItems(array &$field_values, array $unchanged_items, $sync_langcode, array $translations, array $properties);
57
58   /**
59    * Returns the synchronized properties for the specified field definition.
60    *
61    * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
62    *   A field definition.
63    *
64    * @return string[]
65    *   An array of synchronized field property names.
66    */
67   public function getFieldSynchronizedProperties(FieldDefinitionInterface $field_definition);
68
69 }