diff --git a/core/modules/locale/locale.services.yml b/core/modules/locale/locale.services.yml index e37cb48..09dd9f5 100644 --- a/core/modules/locale/locale.services.yml +++ b/core/modules/locale/locale.services.yml @@ -5,7 +5,9 @@ services: public: false locale.config_manager: class: Drupal\locale\LocaleConfigManager - arguments: ['@config.storage', '@locale.storage', '@config.factory', '@config.typed', '@language_manager', '@locale.default.config.storage', '@config.manager'] + arguments: ['@config.storage', '@locale.storage', '@config.factory', '@config.typed', '@language_manager', '@locale.default.config.storage'] + calls: + - [setConfigManager, ['@config.manager']] locale.storage: class: Drupal\locale\StringDatabaseStorage arguments: ['@database'] diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php index d37c73b..56d70fc 100644 --- a/core/modules/locale/src/LocaleConfigManager.php +++ b/core/modules/locale/src/LocaleConfigManager.php @@ -119,17 +119,44 @@ class LocaleConfigManager { * @param \Drupal\locale\LocaleDefaultConfigStorage $default_config_storage * The locale default configuration storage. */ - public function __construct(StorageInterface $config_storage, StringStorageInterface $locale_storage, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, ConfigurableLanguageManagerInterface $language_manager, LocaleDefaultConfigStorage $default_config_storage, ConfigManagerInterface $config_manager) { + public function __construct(StorageInterface $config_storage, StringStorageInterface $locale_storage, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, ConfigurableLanguageManagerInterface $language_manager, LocaleDefaultConfigStorage $default_config_storage) { $this->configStorage = $config_storage; $this->localeStorage = $locale_storage; $this->configFactory = $config_factory; $this->typedConfigManager = $typed_config; $this->languageManager = $language_manager; $this->defaultConfigStorage = $default_config_storage; + } + + /** + * Sets the configuration manager service. + * + * @param \Drupal\Core\Config\ConfigManagerInterface $config_manager + * + * @internal + * Will be replaced by constructor injection in 8.1.0. + */ + public function setConfigManager(ConfigManagerInterface $config_manager) { $this->configManager = $config_manager; } /** + * Gets the configuration manager service. + * + * @return \Drupal\Core\Config\ConfigManagerInterface + * The config manager + * + * @internal + * Will be replaced by constructor injection in 8.1.0. + */ + protected function getConfigManager() { + if (isset($this->configManager)) { + return $this->configManager; + } + return \Drupal::service('config.manager'); + } + + /** * Gets array of translated strings for Locale translatable configuration. * * @param string $name @@ -491,7 +518,7 @@ public function getDefaultConfigLangcode($name) { // 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); + $config_entity_type = $this->getConfigManager()->getEntityTypeIdByName($name); if (!$config_entity_type || $config_entity_type === 'configurable_language' || !empty($this->configFactory->get($name)->get('_core.default_config_hash')) ) {