You are here

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

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

Sets whether the given entity type is Lingotek translatable.

Parameters

string $entity_type_id: The type of the entity.

string $bundle: The bundle of the entity.

bool $enabled: Flag. Defaults to TRUE.

Overrides LingotekConfigurationServiceInterface::setEnabled

File

src/LingotekConfigurationService.php, line 97

Class

LingotekConfigurationService
Service for managing lingotek configuration.

Namespace

Drupal\lingotek

Code

public function setEnabled($entity_type_id, $bundle, $enabled = TRUE) {
  $config = \Drupal::configFactory()
    ->getEditable('lingotek.settings');
  $key = 'translate.entity.' . $entity_type_id . '.' . $bundle . '.enabled';
  $config
    ->set($key, $enabled);
  $config
    ->save();
}