/** * Returns the original language code for this shipped configuration. * * @param string $name * The configuration name. * * @return 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. */ 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; }
/** * Returns the original language code for this shipped configuration. * * @param string $name * The configuration name. * * @return 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. */ public function getDefaultConfigLangcode($name) { $shipped = $this->defaultConfigStorage->read($name); if (!empty($shipped)) { return !empty($shipped['langcode']) ? $shipped['langcode'] : 'en'; } }