function ConfigurableLanguageManager::getNativeLanguages

Same name in other branches
  1. 8.9.x core/modules/language/src/ConfigurableLanguageManager.php \Drupal\language\ConfigurableLanguageManager::getNativeLanguages()
  2. 10 core/modules/language/src/ConfigurableLanguageManager.php \Drupal\language\ConfigurableLanguageManager::getNativeLanguages()
  3. 11.x core/modules/language/src/ConfigurableLanguageManager.php \Drupal\language\ConfigurableLanguageManager::getNativeLanguages()

Overrides LanguageManager::getNativeLanguages

File

core/modules/language/src/ConfigurableLanguageManager.php, line 326

Class

ConfigurableLanguageManager
Overrides default LanguageManager to provide configured languages.

Namespace

Drupal\language

Code

public function getNativeLanguages() {
    $languages = $this->getLanguages(LanguageInterface::STATE_CONFIGURABLE);
    $natives = [];
    $original_language = $this->getConfigOverrideLanguage();
    foreach ($languages as $langcode => $language) {
        $this->setConfigOverrideLanguage($language);
        $natives[$langcode] = ConfigurableLanguage::load($langcode);
    }
    $this->setConfigOverrideLanguage($original_language);
    Language::sort($natives);
    return $natives;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.