Commit a120fedf authored by alexpott's avatar alexpott

Issue #2628132 by joshi.rohit100, id.medion, jordanpagewhite, anil280988:...

Issue #2628132 by joshi.rohit100, id.medion, jordanpagewhite, anil280988: Replace setter inject and internal methods on LocaleConfigManager with constructor injection
parent 0dc48d0c
......@@ -5,9 +5,7 @@ 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']
calls:
- [_setConfigManager, ['@config.manager']]
arguments: ['@config.storage', '@locale.storage', '@config.factory', '@config.typed', '@language_manager', '@locale.default.config.storage', '@config.manager']
locale.storage:
class: Drupal\locale\StringDatabaseStorage
arguments: ['@database']
......
......@@ -100,12 +100,8 @@ class LocaleConfigManager {
* The configuration manager.
*
* @var \Drupal\Core\Config\ConfigManagerInterface
*
* @internal
* Will be made protected and renamed to $configManager in 8.1.0.
* https://www.drupal.org/node/2628132
*/
private $_configManager;
protected $configManager;
/**
* Creates a new typed configuration manager.
......@@ -122,44 +118,17 @@ class LocaleConfigManager {
* The language manager.
* @param \Drupal\locale\LocaleDefaultConfigStorage $default_config_storage
* The locale default configuration storage.
* @param \Drupal\Core\Config\ConfigManagerInterface $config_manager
* The configuration manager.
*/
public function __construct(StorageInterface $config_storage, StringStorageInterface $locale_storage, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, ConfigurableLanguageManagerInterface $language_manager, LocaleDefaultConfigStorage $default_config_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) {
$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.
* https://www.drupal.org/node/2628132
*/
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.
* https://www.drupal.org/node/2628132
*/
private final function _getConfigManager() {
if (!isset($this->_configManager)) {
$this->_configManager = \Drupal::service('config.manager');
}
return $this->_configManager;
$this->configManager = $config_manager;
}
/**
......@@ -524,7 +493,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->_getConfigManager()->getEntityTypeIdByName($name);
$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'))
) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment