Commit fe0e9dd1 authored by catch's avatar catch
Browse files

Issue #1512308 by August1914, Rob Loach, cosmicdreams: Replace...

Issue #1512308 by August1914, Rob Loach, cosmicdreams: Replace $language_content() with Dependency Injection.
parent e1594dbd
...@@ -2626,7 +2626,6 @@ function drupal_language_initialize() { ...@@ -2626,7 +2626,6 @@ function drupal_language_initialize() {
// Remove after these issues: // Remove after these issues:
// - $language_interface: http://drupal.org/node/1510686 // - $language_interface: http://drupal.org/node/1510686
// - $language_url: http://drupal.org/node/1512310 // - $language_url: http://drupal.org/node/1512310
// - $language_content: http://drupal.org/node/1512308
foreach ($types as $type) { foreach ($types as $type) {
$GLOBALS[$type] = $container->get($type); $GLOBALS[$type] = $container->get($type);
} }
......
...@@ -24,5 +24,8 @@ public function __construct() { ...@@ -24,5 +24,8 @@ public function __construct() {
// functions. This default is overridden by drupal_language_initialize() // functions. This default is overridden by drupal_language_initialize()
// during language negotiation. // during language negotiation.
$this->register(LANGUAGE_TYPE_INTERFACE, 'Drupal\\Core\\Language\\Language'); $this->register(LANGUAGE_TYPE_INTERFACE, 'Drupal\\Core\\Language\\Language');
// Register the default language content.
$this->register(LANGUAGE_TYPE_CONTENT, 'Drupal\\Core\\Language\\Language');
} }
} }
...@@ -1675,7 +1675,8 @@ function comment_forms() { ...@@ -1675,7 +1675,8 @@ function comment_forms() {
* @ingroup forms * @ingroup forms
*/ */
function comment_form($form, &$form_state, Comment $comment) { function comment_form($form, &$form_state, Comment $comment) {
global $user, $language_content; global $user;
$language_content = drupal_container()->get(LANGUAGE_TYPE_CONTENT);
// During initial form build, add the comment entity to the form state for // During initial form build, add the comment entity to the form state for
// use during form building and processing. During a rebuild, use what is in // use during form building and processing. During a rebuild, use what is in
......
...@@ -247,8 +247,7 @@ function field_valid_language($langcode, $default = TRUE) { ...@@ -247,8 +247,7 @@ function field_valid_language($langcode, $default = TRUE) {
if (in_array($langcode, $enabled_languages)) { if (in_array($langcode, $enabled_languages)) {
return $langcode; return $langcode;
} }
global $language_content; return $default ? language_default()->langcode : drupal_container()->get(LANGUAGE_TYPE_CONTENT)->langcode;
return $default ? language_default()->langcode : $language_content->langcode;
} }
/** /**
......
...@@ -2384,7 +2384,8 @@ function node_block_list_alter(&$blocks) { ...@@ -2384,7 +2384,8 @@ function node_block_list_alter(&$blocks) {
* @see node_menu() * @see node_menu()
*/ */
function node_feed($nids = FALSE, $channel = array()) { function node_feed($nids = FALSE, $channel = array()) {
global $base_url, $language_content; global $base_url;
$language_content = drupal_container()->get(LANGUAGE_TYPE_CONTENT);
if ($nids === FALSE) { if ($nids === FALSE) {
$nids = db_select('node', 'n') $nids = db_select('node', 'n')
......
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