You are here

public function LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8.2 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  2. 4.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  3. 3.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  4. 3.1.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  5. 3.2.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  6. 3.3.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  7. 3.5.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  8. 3.6.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  9. 3.7.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()
  10. 3.8.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultFieldPropertiesLingotekEnabled()

File

src/LingotekConfigurationService.php, line 374

Class

LingotekConfigurationService
Service for managing lingotek configuration.

Namespace

Drupal\lingotek

Code

public function getDefaultFieldPropertiesLingotekEnabled($entity_type_id, $bundle, $field_name) {

  /** @var \Drupal\Core\Field\FieldDefinitionInterface[] $field_definitions */
  $field_definitions = \Drupal::service('entity_field.manager')
    ->getFieldDefinitions($entity_type_id, $bundle);
  $field_definition = $field_definitions[$field_name];
  $definition = \Drupal::service('plugin.manager.field.field_type')
    ->getDefinition($field_definition
    ->getType());
  $column_groups = $definition['column_groups'];
  $properties = [];
  foreach ($column_groups as $property_id => $property) {
    if (isset($property['translatable']) && $property['translatable']) {
      $property_definitions = $definition['class']::propertyDefinitions($field_definition
        ->getFieldStorageDefinition());
      if (isset($property_definitions[$property_id])) {
        $property_definition = $property_definitions[$property_id];
        if ($property_definition['type'] === 'string') {
          $properties[$property_id] = $property_id;
        }
        else {
          $properties[$property_id] = FALSE;
        }
      }
    }
  }
  return $properties;
}