You are here

public function FieldTranslationSynchronizer::getFieldSynchronizedProperties in Drupal 8

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

Returns the synchronized properties for the specified field definition.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: A field definition.

Return value

string[] An array of synchronized field property names.

Overrides FieldTranslationSynchronizerInterface::getFieldSynchronizedProperties

File

core/modules/content_translation/src/FieldTranslationSynchronizer.php, line 53

Class

FieldTranslationSynchronizer
Provides field translation synchronization capabilities.

Namespace

Drupal\content_translation

Code

public function getFieldSynchronizedProperties(FieldDefinitionInterface $field_definition) {
  $properties = [];
  $settings = $this
    ->getFieldSynchronizationSettings($field_definition);
  foreach ($settings as $group => $translatable) {
    if (!$translatable) {
      $field_type_definition = $this->fieldTypeManager
        ->getDefinition($field_definition
        ->getType());
      if (!empty($field_type_definition['column_groups'][$group]['columns'])) {
        $properties = array_merge($properties, $field_type_definition['column_groups'][$group]['columns']);
      }
    }
  }
  return $properties;
}