You are here

public function LingotekConfigurationService::getFieldsLingotekEnabled in Lingotek Translation 8

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

Gets the Lingotek enabled fields for a given bundle.

@returns array Array of field names.

Parameters

string $entity_type_id: The type of the entity.

string $bundle: The bundle of the entity.

Overrides LingotekConfigurationServiceInterface::getFieldsLingotekEnabled

File

src/LingotekConfigurationService.php, line 178
Contains \Drupal\lingotek\LingotekConfigurationService.

Class

LingotekConfigurationService
Service for managing lingotek configuration.

Namespace

Drupal\lingotek

Code

public function getFieldsLingotekEnabled($entity_type_id, $bundle) {
  $config = \Drupal::config('lingotek.settings');
  $key = 'translate.entity.' . $entity_type_id . '.' . $bundle . '.field';
  $data = $config
    ->get($key);
  $fields = [];
  foreach ($data as $field_name => $properties) {
    if ($properties == 1) {
      $fields[] = $field_name;
    }
    if (is_array($properties)) {
      $fields[] = substr($field_name, 0, strpos($field_name, ':properties'));
    }
  }
  return $fields;
}