function LocaleConfigManager::getDefaultConfigLangcode
Same name in other branches
- 8.9.x core/modules/locale/src/LocaleConfigManager.php \Drupal\locale\LocaleConfigManager::getDefaultConfigLangcode()
- 10 core/modules/locale/src/LocaleConfigManager.php \Drupal\locale\LocaleConfigManager::getDefaultConfigLangcode()
- 11.x core/modules/locale/src/LocaleConfigManager.php \Drupal\locale\LocaleConfigManager::getDefaultConfigLangcode()
Returns the original language code for this shipped configuration.
Parameters
string $name: The configuration name.
Return value
null|string Language code of the default configuration for $name. If the default configuration data for $name did not contain a language code, it is assumed to be English. The return value is NULL if no such default configuration exists.
1 call to LocaleConfigManager::getDefaultConfigLangcode()
- LocaleConfigManager::isSupported in core/
modules/ locale/ src/ LocaleConfigManager.php - Whether the given configuration is supported for interface translation.
File
-
core/
modules/ locale/ src/ LocaleConfigManager.php, line 484
Class
- LocaleConfigManager
- Manages configuration supported in part by interface translation.
Namespace
Drupal\localeCode
public function getDefaultConfigLangcode($name) {
// Config entities that do not have the 'default_config_hash' cannot be
// shipped configuration regardless of whether there is a name match.
// configurable_language entities are a special case since they can be
// translated regardless of whether they are shipped if they in the standard
// language list.
$config_entity_type = $this->configManager
->getEntityTypeIdByName($name);
if (!$config_entity_type || $config_entity_type === 'configurable_language' || !empty($this->configFactory
->get($name)
->get('_core.default_config_hash'))) {
$shipped = $this->defaultConfigStorage
->read($name);
if (!empty($shipped)) {
return !empty($shipped['langcode']) ? $shipped['langcode'] : 'en';
}
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.