summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-03-10 10:40:50 +0000
committerAlex Pott2016-03-10 10:40:50 +0000
commita120fedff984bc2ea7274eee04987cd0b37bea34 (patch)
tree7b4eb6273b5b2097ac1a82784b451f6e3ed40ce1
parent0dc48d0ccaee310253624c15c75f5fef63e4f537 (diff)
Issue #2628132 by joshi.rohit100, id.medion, jordanpagewhite, anil280988: Replace setter inject and internal methods on LocaleConfigManager with constructor injection
-rw-r--r--core/modules/locale/locale.services.yml4
-rw-r--r--core/modules/locale/src/LocaleConfigManager.php43
2 files changed, 7 insertions, 40 deletions
diff --git a/core/modules/locale/locale.services.yml b/core/modules/locale/locale.services.yml
index 1d55460..e37cb48 100644
--- a/core/modules/locale/locale.services.yml
+++ b/core/modules/locale/locale.services.yml
@@ -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']
diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php
index db6c181..028e75a 100644
--- a/core/modules/locale/src/LocaleConfigManager.php
+++ b/core/modules/locale/src/LocaleConfigManager.php
@@ -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 @@ class LocaleConfigManager {
// 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'))
) {