function LanguageServiceProvider::getDefaultLanguageValues
Same name in other branches
- 9 core/modules/language/src/LanguageServiceProvider.php \Drupal\language\LanguageServiceProvider::getDefaultLanguageValues()
- 8.9.x core/modules/language/src/LanguageServiceProvider.php \Drupal\language\LanguageServiceProvider::getDefaultLanguageValues()
- 10 core/modules/language/src/LanguageServiceProvider.php \Drupal\language\LanguageServiceProvider::getDefaultLanguageValues()
Gets the default language values.
Return value
array|bool Returns the default language values for the language configured in system.site:default_langcode if the corresponding configuration entity exists, otherwise FALSE.
1 call to LanguageServiceProvider::getDefaultLanguageValues()
- LanguageServiceProvider::alter in core/
modules/ language/ src/ LanguageServiceProvider.php - Modifies existing service definitions.
File
-
core/
modules/ language/ src/ LanguageServiceProvider.php, line 87
Class
- LanguageServiceProvider
- Overrides the language_manager service to point to language's module one.
Namespace
Drupal\languageCode
protected function getDefaultLanguageValues() {
$config_storage = BootstrapConfigStorageFactory::get();
$system = $config_storage->read('system.site');
// In Kernel tests it's possible this code is called before system.site
// exists. In such cases behave as though the corresponding language
// configuration entity does not exist.
if ($system === FALSE) {
return FALSE;
}
$default_language = $config_storage->read(static::CONFIG_PREFIX . $system['default_langcode']);
if (is_array($default_language)) {
return $default_language;
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.