You are here

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

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

Returns all the languages that are Lingotek enabled.

Return value

\Drupal\language\ConfigurableLanguageInterface[] The languages.

Overrides LingotekConfigurationServiceInterface::getEnabledLanguages

File

src/LingotekConfigurationService.php, line 452

Class

LingotekConfigurationService
Service for managing lingotek configuration.

Namespace

Drupal\lingotek

Code

public function getEnabledLanguages() {
  $languages = \Drupal::languageManager()
    ->getLanguages();

  // Filter the disabled languages.
  $languages = array_filter($languages, function (LanguageInterface $language) {
    $configLanguage = ConfigurableLanguage::load($language
      ->getId());
    return $this
      ->isLanguageEnabled($configLanguage);
  });
  return $languages;
}