public function ConfigurableLanguageManager::getNativeLanguages in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/src/ConfigurableLanguageManager.php \Drupal\language\ConfigurableLanguageManager::getNativeLanguages()
- 9 core/modules/language/src/ConfigurableLanguageManager.php \Drupal\language\ConfigurableLanguageManager::getNativeLanguages()
File
- core/
modules/ language/ src/ ConfigurableLanguageManager.php, line 326
Class
- ConfigurableLanguageManager
- Overrides default LanguageManager to provide configured languages.
Namespace
Drupal\languageCode
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;
}