drupal_container() is deprecated, and all calls in the config module need to be replaced with Drupal::service(), except for where the module_handler service is requested, which needs to be replaced with Drupal::moduleHandler() (see #1957154)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ebeyrent’s picture

Status: Active » Needs review
FileSize
1.55 KB
ebeyrent’s picture

Component: comment.module » config.module
dawehner’s picture

+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.phpundefined
@@ -110,7 +110,7 @@ function testConfigLocaleUserOverride() {
+    $config_factory = \Drupal::service('config.factory');

This could be just $this->container->get('config.factory')

Status: Needs review » Needs work

The last submitted patch, 2003576-1.patch, failed testing.

alexander.ilivanov’s picture

Assigned: ebeyrent » alexander.ilivanov
Status: Needs work » Needs review
Issue tags: +CodeSprintUA
FileSize
1.55 KB

drupal_container() replaced
Patch attached.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, replace-drupal_container-2003576-5.patch, failed testing.

dawehner’s picture

+++ b/core/modules/config/config.admin.incundefined
@@ -113,8 +113,8 @@ function config_admin_sync_form(array &$form, array &$form_state, StorageInterfa
+  $target_storage = Drupal::service('config.storage.staging');

This should use the $source_storage.

JeroenT’s picture

Status: Needs work » Needs review
FileSize
1.55 KB

replaced drupal_container with Drupal::service.

Status: Needs review » Needs work

The last submitted patch, config-replace_drupal_container-2003576-9.patch, failed testing.

ddrozdik’s picture

--- a/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php
@@ -110,7 +110,7 @@ function testConfigLocaleUserOverride() {
       'preferred_langcode' => 'de',
     ));
 
-    $config_factory = drupal_container()->get('config.factory');
+    $config_factory = Drupal::service('config.factory');

Please use \Drupal::service('config.factory'); in clases.

JeroenT’s picture

Status: Needs work » Needs review
FileSize
1.55 KB

Made changes as suggested by DmitryDrozdik.

ebeyrent’s picture

+++ b/core/modules/config/config.admin.inc
@@ -113,8 +113,8 @@ function config_admin_sync_form(array &$form, array &$form_state, StorageInterfa
+  $source_storage = \Drupal::service('config.storage.staging');

Need to remove the backslash when in module code.

Should be:

Drupal::service('config.storage.staging');
Drupal::service('config.storage');

JeroenT’s picture

made changes as suggested by ebeyrent.

ebeyrent’s picture

Status: Needs review » Reviewed & tested by the community

RTBC

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

ddrozdik’s picture

Status: Fixed » Closed (fixed)