diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 0c18a60..19e8370 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1095,7 +1095,6 @@ function menu_tree_output($tree) { */ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { $tree = &drupal_static(__FUNCTION__, array()); - $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Use $mlid as a flag for whether the data being loaded is for the whole tree. @@ -1363,7 +1362,6 @@ function menu_build_tree($menu_name, array $parameters = array()) { function _menu_build_tree($menu_name, array $parameters = array()) { // Static cache of already built menu trees. $trees = &drupal_static(__FUNCTION__, array()); - $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Build the cache id; sort parents to prevent duplicate storage and remove diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 6ea7285..ea1dd1e 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2788,6 +2788,12 @@ function theme_get_suggestions($args, $base, $delimiter = '__') { * @see maintenance-page.tpl.php */ function template_preprocess_maintenance_page(&$variables) { + global $theme; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); + // Retrieve the theme data to list all available regions. + $theme_data = list_themes(); + $regions = $theme_data[$theme]->info['regions']; + // Add favicon if (theme_get_setting('toggle_favicon')) { $favicon = theme_get_setting('favicon'); @@ -2795,11 +2801,6 @@ function template_preprocess_maintenance_page(&$variables) { drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type)); } - global $theme; - // Retrieve the theme data to list all available regions. - $theme_data = list_themes(); - $regions = $theme_data[$theme]->info['regions']; - // Get all region content set with drupal_add_region_content(). foreach (array_keys($regions) as $region) { // Assign region to a region variable. @@ -2830,8 +2831,6 @@ function template_preprocess_maintenance_page(&$variables) { } } - $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); - $variables['head_title_array'] = $head_title; $variables['head_title'] = implode(' | ', $head_title); $variables['base_path'] = base_path(); diff --git a/core/modules/block/block.api.php b/core/modules/block/block.api.php index a3d59b0..9fee858 100644 --- a/core/modules/block/block.api.php +++ b/core/modules/block/block.api.php @@ -328,7 +328,8 @@ function hook_block_view_MODULE_DELTA_alter(&$data, $block) { * An array of $blocks, keyed by the block ID. */ function hook_block_list_alter(&$blocks) { - global $language_interface, $theme_key; + global $theme_key; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // This example shows how to achieve language specific visibility setting for // blocks. diff --git a/core/modules/book/book.module b/core/modules/book/book.module index bbdfab3..6d111d9 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -1224,7 +1224,8 @@ function book_toc($bid, $depth_limit, $exclude = array()) { * @see book-export-html.tpl.php */ function template_preprocess_book_export_html(&$variables) { - global $base_url, $language_interface; + global $base_url; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $variables['title'] = check_plain($variables['title']); $variables['base_url'] = $base_url; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php index a658cfb..aea41ef 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -23,7 +23,7 @@ class CommentTokenReplaceTest extends CommentTestBase { * Creates a comment, then tests the tokens generated from it. */ function testCommentTokenReplacement() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, diff --git a/core/modules/contact/contact.pages.inc b/core/modules/contact/contact.pages.inc index 2a27cf1..7896ae5 100644 --- a/core/modules/contact/contact.pages.inc +++ b/core/modules/contact/contact.pages.inc @@ -129,7 +129,8 @@ function contact_site_form_validate($form, &$form_state) { * @see contact_site_form_validate() */ function contact_site_form_submit($form, &$form_state) { - global $user, $language_interface; + global $user; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $values = $form_state['values']; $values['sender'] = $user; @@ -250,7 +251,8 @@ function contact_personal_form($form, &$form_state, $recipient) { * @see contact_personal_form_validate() */ function contact_personal_form_submit($form, &$form_state) { - global $user, $language_interface; + global $user; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $values = $form_state['values']; $values['sender'] = $user; diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module index 26dfc67..daaa9f6 100644 --- a/core/modules/entity/entity.module +++ b/core/modules/entity/entity.module @@ -45,7 +45,7 @@ function entity_modules_disabled() { * @see hook_entity_info_alter() */ function entity_get_info($entity_type = NULL) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc index 7ce5b98..3d7f546 100644 --- a/core/modules/field/field.info.inc +++ b/core/modules/field/field.info.inc @@ -67,7 +67,7 @@ function field_info_cache_clear() { * @see _field_info_collate_types_reset() */ function _field_info_collate_types() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; diff --git a/core/modules/file/tests/file.test b/core/modules/file/tests/file.test index fd25930..0f70aa6 100644 --- a/core/modules/file/tests/file.test +++ b/core/modules/file/tests/file.test @@ -1079,7 +1079,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase { * Creates a file, then tests the tokens generated from it. */ function testFileTokenReplacement() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 94d8a03..b7a3059 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -399,7 +399,7 @@ function filter_modules_disabled($modules) { * @see filter_formats_reset() */ function filter_formats($account = NULL) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $formats = &drupal_static(__FUNCTION__, array()); // All available formats are cached for performance. diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 905e6a7..f3bf83d 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -923,7 +923,7 @@ function image_style_path($style_name, $uri) { * @see image_effect_definition_load() */ function image_effect_definitions() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // hook_image_effect_info() includes translated strings, so each language is // cached separately. diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 7acc783..6704f95 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -234,7 +234,7 @@ function language_delete($langcode) { * and checks to see if a related right to left CSS file should be included. */ function language_css_alter(&$css) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // If the current language is RTL, add the CSS file with the RTL overrides. if ($language_interface->direction == LANGUAGE_RTL) { diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 35f8032..668e089 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -190,8 +190,8 @@ function locale_menu() { * Initialize date formats according to the user's current locale. */ function locale_init() { - global $conf, $language_interface; - + global $conf; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // For each date type (e.g. long, short), get the localized date format // for the user's current language and override the default setting for it // in $conf. This should happen on all pages except the date and time formats @@ -389,7 +389,7 @@ function locale_language_delete($language) { * Language code to use for the lookup. */ function locale($string = NULL, $context = NULL, $langcode = NULL) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; @@ -502,7 +502,7 @@ function locale_reset() { * plural formula. */ function locale_get_plural($count, $langcode = NULL) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Used to locally cache the plural formulas for all languages. $plural_formulas = &drupal_static(__FUNCTION__, array()); @@ -588,7 +588,7 @@ function locale_system_update($components) { * file if necessary, and adds it to the page. */ function locale_js_alter(&$javascript) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $dir = 'public://' . variable_get('locale_js_directory', 'languages'); $parsed = variable_get('javascript_parsed', array()); @@ -647,7 +647,7 @@ function locale_js_alter(&$javascript) { * Provides the language support for the jQuery UI Date Picker. */ function locale_library_info_alter(&$libraries, $module) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); if ($module == 'system' && isset($libraries['system']['ui.datepicker'])) { $datepicker = drupal_get_path('module', 'locale') . '/locale.datepicker.js'; $libraries['system']['ui.datepicker']['js'][$datepicker] = array('group' => JS_THEME); @@ -785,7 +785,7 @@ function locale_form_system_file_system_settings_alter(&$form, $form_state) { */ function locale_preprocess_node(&$variables) { if ($variables['langcode'] != LANGUAGE_NOT_SPECIFIED) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $node_language = language_load($variables['langcode']); if ($node_language->langcode != $language_interface->langcode) { diff --git a/core/modules/openid/openid.inc b/core/modules/openid/openid.inc index 518dc8a..d594dde 100644 --- a/core/modules/openid/openid.inc +++ b/core/modules/openid/openid.inc @@ -83,7 +83,7 @@ function openid_redirect_http($url, $message) { * Creates a js auto-submit redirect for (for the 2.x protocol) */ function openid_redirect($url, $message) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $output = '' . "\n"; $output .= '' . "\n"; diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php index 1e19ec0..3aaab13 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php @@ -23,7 +23,7 @@ class PollTokenReplaceTest extends PollTestBase { * Creates a poll, then tests the tokens generated from it. */ function testPollTokenReplacement() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Craete a poll with three choices. $title = $this->randomName(); diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc index ff0d271..c940223 100644 --- a/core/modules/search/search.pages.inc +++ b/core/modules/search/search.pages.inc @@ -104,7 +104,7 @@ function template_preprocess_search_results(&$variables) { * @see search-result.tpl.php */ function template_preprocess_search_result(&$variables) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $result = $variables['result']; $variables['url'] = check_url($result['link']); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index 12c6f11..902fe6a 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -608,7 +608,8 @@ abstract class TestBase { * @see TestBase::tearDown() */ protected function prepareEnvironment() { - global $user, $language_interface, $conf; + global $user, $conf; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Backup current in-memory configuration. $this->originalConf = $conf; @@ -672,7 +673,8 @@ abstract class TestBase { * @see TestBase::prepareEnvironment() */ protected function tearDown() { - global $user, $language_interface, $conf; + global $user, $conf; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // In case a fatal error occurred that was not in the test process read the // log to pick up any fatal errors. diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index 3384e2c..f1a5f95 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -578,7 +578,8 @@ abstract class WebTestBase extends TestBase { * @see Drupal\simpletest\WebTestBase::prepareEnvironment() */ protected function setUp() { - global $user, $language_interface, $conf; + global $user, $conf; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Create the database prefix for this test. $this->prepareDatabasePrefix(); diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php index 3045611..0cc6e41 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php @@ -23,7 +23,7 @@ class StatisticsTokenReplaceTest extends StatisticsTestBase { * Creates a node, then tests the statistics tokens generated from it. */ function testStatisticsTokenReplacement() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Create user and node. $user = $this->drupalCreateUser(array('create page content')); diff --git a/core/modules/system/language.api.php b/core/modules/system/language.api.php index f1cd519..903de4a 100644 --- a/core/modules/system/language.api.php +++ b/core/modules/system/language.api.php @@ -52,7 +52,7 @@ function hook_language_init() { * The current path. */ function hook_language_switch_links_alter(array &$links, $type, $path) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); if ($type == LANGUAGE_TYPE_CONTENT && isset($links[$language_interface->langcode])) { foreach ($links[$language_interface->langcode] as $link) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php index 9c3d7aa..441a2ba 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php @@ -218,7 +218,7 @@ class CascadingStylesheetsTest extends WebTestBase { */ function testAlter() { // Switch the language to a right to left language and add system.base.css. - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $language_interface->direction = LANGUAGE_RTL; $path = drupal_get_path('module', 'system'); drupal_add_css($path . '/system.base.css'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/MailTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/MailTest.php index cf33f48..831fcea 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/MailTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/MailTest.php @@ -41,7 +41,7 @@ class MailTest extends WebTestBase implements MailInterface { * Assert that the pluggable mail system is functional. */ public function testPluggableFramework() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Use MailTestCase for sending a message. $message = drupal_mail('simpletest', 'mail_test', 'testing@example.com', $language_interface); diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index ed5b7a0..0510dfb 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1975,7 +1975,8 @@ function hook_xmlrpc_alter(&$methods) { * the message is not possible to translate. */ function hook_watchdog(array $log_entry) { - global $base_url, $language_interface; + global $base_url; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $severity_list = array( WATCHDOG_EMERGENCY => t('Emergency'), diff --git a/core/modules/system/system.test b/core/modules/system/system.test index 17b96c8..8222e2d 100644 --- a/core/modules/system/system.test +++ b/core/modules/system/system.test @@ -1950,11 +1950,13 @@ class TokenReplaceTestCase extends WebTestBase { * Creates a user and a node, then tests the tokens generated from them. */ function testTokenReplacement() { + global $user; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); + // Create the initial objects. $account = $this->drupalCreateUser(); $node = $this->drupalCreateNode(array('uid' => $account->uid)); $node->title = 'Blinking Text'; - global $user, $language_interface; $source = '[node:title]'; // Title of the node we passed in $source .= '[node:author:name]'; // Node author's name @@ -1999,7 +2001,7 @@ class TokenReplaceTestCase extends WebTestBase { * Test whether token-replacement works in various contexts. */ function testSystemTokenRecognition() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Generate prefixes and suffixes for the token context. $tests = array( @@ -2028,7 +2030,8 @@ class TokenReplaceTestCase extends WebTestBase { * Tests the generation of all system site information tokens. */ function testSystemSiteTokenReplacement() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); + $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, @@ -2069,7 +2072,7 @@ class TokenReplaceTestCase extends WebTestBase { * Tests the generation of all system date tokens. */ function testSystemDateTokenReplacement() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Set time to one hour before request. $date = REQUEST_TIME - 3600; diff --git a/core/modules/system/tests/upgrade/upgrade.test b/core/modules/system/tests/upgrade/upgrade.test index 429bddb..97b85be 100644 --- a/core/modules/system/tests/upgrade/upgrade.test +++ b/core/modules/system/tests/upgrade/upgrade.test @@ -70,7 +70,7 @@ abstract class UpgradePathTestCase extends WebTestBase { * @see Drupal\simpletest\WebTestBase::prepareEnvironment() */ protected function setUp() { - global $user, $language_interface, $conf; + global $user, $conf; // Load the Update API. require_once DRUPAL_ROOT . '/core/includes/update.inc'; diff --git a/core/modules/taxonomy/taxonomy.test b/core/modules/taxonomy/taxonomy.test index c7e87e8..74ae013 100644 --- a/core/modules/taxonomy/taxonomy.test +++ b/core/modules/taxonomy/taxonomy.test @@ -1776,7 +1776,7 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase { * Creates some terms and a node, then tests the tokens generated from them. */ function testTaxonomyTokenReplacement() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); // Create two taxonomy terms. $term1 = $this->createTerm($this->vocabulary); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php index d6466cd..5cd3cd3 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php @@ -25,7 +25,7 @@ class UserTokenReplaceTest extends WebTestBase { * Creates a user, then tests the tokens generated from it. */ function testUserTokenReplacement() { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, 'language' => $language_interface, diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 01934b4..91aff01 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -700,7 +700,8 @@ function user_user_view($account) { * @see user_validate_mail() */ function user_account_form(&$form, &$form_state) { - global $user, $language_interface; + global $user; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $account = $form['#user']; $register = ($form['#user']->uid > 0 ? FALSE : TRUE); diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index fcda92e..436035e 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -74,7 +74,7 @@ function user_pass_validate($form, &$form_state) { } function user_pass_submit($form, &$form_state) { - global $language_interface; + $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); $account = $form_state['values']['account']; // Mail one time login URL and instructions using current language. diff --git a/core/update.php b/core/update.php index b47702e..3ace66a 100644 --- a/core/update.php +++ b/core/update.php @@ -383,10 +383,6 @@ update_prepare_d8_bootstrap(); // Determine if the current user has access to run update.php. drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION); -// The interface language global has been renamed in D8, we must ensure that it -// contains a valid value while language settings are upgraded. -// @todo Remove this globals reference entirely: http://drupal.org/node/1510686 -$GLOBALS[LANGUAGE_TYPE_INTERFACE] = language_default(); // Ensure the default language is properly registered within the Dependency // Injection container during the upgrade process.