diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php index aee2d59..98cf4dc 100644 --- a/core/modules/locale/src/LocaleConfigManager.php +++ b/core/modules/locale/src/LocaleConfigManager.php @@ -104,22 +104,25 @@ public function __construct(StorageInterface $config_storage, StorageInterface $ * @param string $name * Configuration object name. * - * @return \Drupal\locale\LocaleTypedConfig - * Locale-wrapped configuration element. + * @return null|\Drupal\locale\LocaleTypedConfig + * Locale-wrapped configuration element if the default configuration and + * active configuration both existed for $name. NULL otherwise. */ public function get($name) { // Read default and current configuration data. $default = $this->installStorageRead($name); $updated = $this->configStorage->read($name); - // We get only the data that didn't change from default. - $data = $this->compareConfigData($default, $updated); - $definition = $this->typedConfigManager->getDefinition($name); - $data_definition = $this->typedConfigManager->buildDataDefinition($definition, $data); - // Unless the configuration has a explicit language code we assume English. - $langcode = isset($default['langcode']) ? $default['langcode'] : 'en'; - $wrapper = new LocaleTypedConfig($data_definition, $name, $langcode, $this, $this->typedConfigManager, $this->languageManager); - $wrapper->setValue($data); - return $wrapper; + if (is_array($default) && is_array($updated)) { + // We get only the data that didn't change from default. + $data = $this->compareConfigData($default, $updated); + $definition = $this->typedConfigManager->getDefinition($name); + $data_definition = $this->typedConfigManager->buildDataDefinition($definition, $data); + // Unless the configuration has a explicit language code we assume English. + $langcode = isset($default['langcode']) ? $default['langcode'] : 'en'; + $wrapper = new LocaleTypedConfig($data_definition, $name, $langcode, $this, $this->typedConfigManager, $this->languageManager); + $wrapper->setValue($data); + return $wrapper; + } } /**