From 82f095ad2e19b701667e97c426f2de28151551a6 Mon Sep 17 00:00:00 2001 From: webchick Date: Thu, 14 Jun 2012 10:22:49 +0200 Subject: [PATCH] Issue #1631092 by webflo: Remove language related todos and global variables from boostrap.inc. --- core/includes/bootstrap.inc | 7 ------- core/modules/block/block.module | 2 +- core/modules/node/node.module | 4 ++-- core/modules/taxonomy/taxonomy.module | 2 +- core/modules/user/user.module | 4 ++-- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 6a78081c8f2..acc82d6710a 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2617,13 +2617,6 @@ function drupal_language_initialize() { ->addMethodCall('extend', array($default)); } } - - // @todo Temporary backwards compatibility for code still using globals. - // Remove after these issues: - // - $language_url: http://drupal.org/node/1512310 - foreach ($types as $type) { - $GLOBALS[$type] = $container->get($type); - } } /** diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 5c43a84414d..50bae7644fc 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -880,7 +880,7 @@ function block_block_list_alter(&$blocks) { continue; } foreach ($block_langcodes[$block->module][$block->delta] as $language_type => $langcodes) { - if (isset($langcodes[$GLOBALS[$language_type]->langcode])) { + if (isset($langcodes[drupal_container()->get($language_type)->langcode])) { // Found a language type - langcode combination in the configuration // that is applicable to the current request. continue 2; diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 171a74b39d1..e787c7d48be 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1132,7 +1132,7 @@ function node_revision_delete($revision_id) { */ function node_view(Node $node, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = $GLOBALS['language_content']->langcode; + $langcode = drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode; } // Populate $node->content with a render() array. @@ -1194,7 +1194,7 @@ function node_view(Node $node, $view_mode = 'full', $langcode = NULL) { */ function node_build_content(Node $node, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = $GLOBALS['language_content']->langcode; + $langcode = drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode; } // Remove previously built content, if exists. diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 83ed235b411..ba74a9a7bf2 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -584,7 +584,7 @@ function taxonomy_term_delete_multiple(array $tids) { */ function taxonomy_term_view(Term $term, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = $GLOBALS['language_content']->langcode; + $langcode = drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode; } field_attach_prepare_view('taxonomy_term', array($term->tid => $term), $view_mode, $langcode); diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 6a04d7cc215..6f21c5c4c1e 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -2367,7 +2367,7 @@ function user_view_page($account) { */ function user_view($account, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = $GLOBALS['language_content']->langcode; + $langcode = drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode; } // Retrieve all profile fields and attach to $account->content. @@ -2404,7 +2404,7 @@ function user_view($account, $view_mode = 'full', $langcode = NULL) { */ function user_build_content($account, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = $GLOBALS['language_content']->langcode; + $langcode = drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode; } // Remove previously built content, if exists.