public function LingotekConfigurationService::isFieldLingotekEnabled in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 4.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.1.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.2.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.3.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.4.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.5.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.6.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.7.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
- 3.8.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isFieldLingotekEnabled()
Determines if the field is enabled for Lingotek translation.
@returns bool TRUE if the specified field is configured for Lingotek translation.
Parameters
string $entity_type_id: The type of the entity.
string $bundle: The bundle of the entity.
string $field_name: The field of the bundle.
Overrides LingotekConfigurationServiceInterface::isFieldLingotekEnabled
File
- src/
LingotekConfigurationService.php, line 197 - Contains \Drupal\lingotek\LingotekConfigurationService.
Class
- LingotekConfigurationService
- Service for managing lingotek configuration.
Namespace
Drupal\lingotekCode
public function isFieldLingotekEnabled($entity_type_id, $bundle, $field_name) {
$field_definitions = \Drupal::entityManager()
->getFieldDefinitions($entity_type_id, $bundle);
$config = \Drupal::config('lingotek.settings');
$key = 'translate.entity.' . $entity_type_id . '.' . $bundle . '.field.' . $field_name;
// We allow non-translatable entity_reference_revisions fields through.
// See https://www.drupal.org/node/2788285
// We also support paths even if they are not translatable (which may happen
// if they are computed fields.
$excluded_types = [
'path',
'entity_reference_revisions',
];
return !empty($field_definitions[$field_name]) && ($field_definitions[$field_name]
->isTranslatable() || in_array($field_definitions[$field_name]
->getType(), $excluded_types)) && !!$config
->get($key);
}