public function LocaleDefaultConfigStorage::read in Drupal 9
Same name and namespace in other branches
- 8 core/modules/locale/src/LocaleDefaultConfigStorage.php \Drupal\locale\LocaleDefaultConfigStorage::read()
Read a configuration from install storage or default languages.
Parameters
string $name: Configuration object name.
Return value
array Configuration data from install storage or default language.
File
- core/
modules/ locale/ src/ LocaleDefaultConfigStorage.php, line 79
Class
- LocaleDefaultConfigStorage
- Provides access to default configuration for locale integration.
Namespace
Drupal\localeCode
public function read($name) {
if ($this->requiredInstallStorage
->exists($name)) {
return $this->requiredInstallStorage
->read($name);
}
elseif ($this->optionalInstallStorage
->exists($name)) {
return $this->optionalInstallStorage
->read($name);
}
elseif (strpos($name, 'language.entity.') === 0) {
// Simulate default languages as if they were shipped as default
// configuration.
$langcode = str_replace('language.entity.', '', $name);
$predefined_languages = $this->languageManager
->getStandardLanguageList();
if (isset($predefined_languages[$langcode])) {
$data = $this->configStorage
->read($name);
$data['label'] = $predefined_languages[$langcode][0];
return $data;
}
}
}