public function LingotekConfigurationService::isEnabled in Lingotek Translation 8.2
Same name and namespace in other branches
- 8 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 4.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.1.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.2.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.3.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.4.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.5.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.6.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.7.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
- 3.8.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::isEnabled()
Determines whether the given entity type is Lingotek translatable.
@returns bool TRUE if the specified bundle is configured for Lingotek translation. If no bundle is provided returns TRUE if at least one of the entity bundles is translatable.
Parameters
string $entity_type_id: The type of the entity.
string $bundle: (optional) The bundle of the entity. If no bundle is provided, all the available bundles are checked.
Overrides LingotekConfigurationServiceInterface::isEnabled
2 calls to LingotekConfigurationService::isEnabled()
- LingotekConfigurationService::getDefaultProfileId in src/
LingotekConfigurationService.php - Determines the default Lingotek profile for the given entity type.
- LingotekConfigurationService::getEnabledEntityTypes in src/
LingotekConfigurationService.php - Gets the entity types that are enabled for Lingotek content translation.
File
- src/
LingotekConfigurationService.php, line 34
Class
- LingotekConfigurationService
- Service for managing lingotek configuration.
Namespace
Drupal\lingotekCode
public function isEnabled($entity_type_id, $bundle = NULL) {
$result = FALSE;
$config = \Drupal::config('lingotek.settings');
if ($bundle === NULL) {
// Check if any bundle is enabled.
$bundles = \Drupal::service('entity_type.bundle.info')
->getBundleInfo($entity_type_id);
foreach ($bundles as $bundle_id => $bundle_definition) {
$result = $this
->isEnabled($entity_type_id, $bundle_id);
if ($result) {
break;
}
}
}
else {
$key = 'translate.entity.' . $entity_type_id . '.' . $bundle . '.enabled';
$result = !!$config
->get($key);
}
return $result;
}