summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2014-02-26 19:16:54 (GMT)
committerwebchick2014-02-26 19:16:54 (GMT)
commit5d0729f07a08ee6f3ec771483ec8e81c8d348798 (patch)
tree81e5064b33da18e6728826ab9a6c71a7f7421176
parent57661ff99492748e48234cdd4cd912de62d32251 (diff)
Issue #2070369 by herom, bdgreen, Mac_Weber, InternetDevels, sidharthap, JeroenT: Remove all calls to deprecated function language().
-rw-r--r--core/includes/common.inc2
-rw-r--r--core/includes/entity.inc4
-rw-r--r--core/includes/form.inc2
-rw-r--r--core/includes/menu.inc6
-rw-r--r--core/includes/theme.inc4
-rw-r--r--core/lib/Drupal.php2
-rw-r--r--core/lib/Drupal/Core/Datetime/DrupalDateTime.php2
-rw-r--r--core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php8
-rw-r--r--core/lib/Drupal/Core/Url.php4
-rw-r--r--core/lib/Drupal/Core/Validation/DrupalTranslator.php2
-rw-r--r--core/modules/block/lib/Drupal/block/BlockAccessController.php2
-rw-r--r--core/modules/book/book.module2
-rw-r--r--core/modules/book/lib/Drupal/book/BookManager.php4
-rw-r--r--core/modules/ckeditor/ckeditor.admin.inc2
-rw-r--r--core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php2
-rw-r--r--core/modules/contact/lib/Drupal/contact/MessageFormController.php2
-rw-r--r--core/modules/content_translation/content_translation.module6
-rw-r--r--core/modules/content_translation/content_translation.pages.inc4
-rw-r--r--core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php4
-rw-r--r--core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php2
-rw-r--r--core/modules/language/language.module2
-rw-r--r--core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php2
-rw-r--r--core/modules/language/tests/language_test/language_test.module4
-rw-r--r--core/modules/locale/locale.module10
-rw-r--r--core/modules/node/node.module4
-rw-r--r--core/modules/search/search.pages.inc2
-rw-r--r--core/modules/simpletest/lib/Drupal/simpletest/TestBase.php2
-rw-r--r--core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php2
-rw-r--r--core/modules/system/language.api.php4
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php6
-rw-r--r--core/modules/system/system.api.php4
-rw-r--r--core/modules/system/system.module2
-rw-r--r--core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php2
-rw-r--r--core/modules/system/theme.api.php2
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php2
-rw-r--r--core/modules/user/lib/Drupal/user/AccountFormController.php2
-rw-r--r--core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php2
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php4
-rw-r--r--core/modules/views/views.api.php2
-rw-r--r--core/modules/views/views.theme.inc2
-rw-r--r--core/modules/views/views.views_execution.inc2
42 files changed, 66 insertions, 66 deletions
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 1f2b74b..7415803 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -768,7 +768,7 @@ function filter_xss_bad_protocol($string) {
* Arbitrary elements may be added using the $args associative array.
*/
function format_rss_channel($title, $link, $description, $items, $langcode = NULL, $args = array()) {
- $langcode = $langcode ? $langcode : language(Language::TYPE_CONTENT)->id;
+ $langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->id;
$output = "<channel>\n";
$output .= ' <title>' . String::checkPlain($title) . "</title>\n";
diff --git a/core/includes/entity.inc b/core/includes/entity.inc
index 0ade970..39701ef 100644
--- a/core/includes/entity.inc
+++ b/core/includes/entity.inc
@@ -93,7 +93,7 @@ function entity_invoke_bundle_hook($hook, $entity_type, $bundle, $bundle_new = N
function entity_get_form_modes($entity_type = NULL) {
$form_modes = &drupal_static(__FUNCTION__);
if (!$form_modes) {
- $langcode = language(Language::TYPE_INTERFACE)->id;
+ $langcode = \Drupal::languageManager()->getCurrentLanguage()->id;
if ($cache = \Drupal::cache()->get("entity_form_mode_info:$langcode")) {
$form_modes = $cache->data;
}
@@ -131,7 +131,7 @@ function entity_get_form_modes($entity_type = NULL) {
function entity_get_view_modes($entity_type = NULL) {
$view_modes = &drupal_static(__FUNCTION__);
if (!$view_modes) {
- $langcode = language(Language::TYPE_INTERFACE)->id;
+ $langcode = \Drupal::languageManager()->getCurrentLanguage()->id;
if ($cache = \Drupal::cache()->get("entity_view_mode_info:$langcode")) {
$view_modes = $cache->data;
}
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 454a016..15c6634 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -1898,7 +1898,7 @@ function form_validate_table($element, &$form_state) {
*/
function form_process_machine_name($element, &$form_state) {
// We need to pass the langcode to the client.
- $language = language(Language::TYPE_INTERFACE);
+ $language = \Drupal::languageManager()->getCurrentLanguage();
// Apply default form element properties.
$element += array(
diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index 495fb47..053239e 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -1009,7 +1009,7 @@ function menu_tree_output($tree) {
*/
function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) {
$tree = &drupal_static(__FUNCTION__, array());
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Use $mlid as a flag for whether the data being loaded is for the whole tree.
$mlid = isset($link['mlid']) ? $link['mlid'] : 0;
@@ -1120,7 +1120,7 @@ function menu_tree_get_path($menu_name) {
function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = FALSE) {
$tree = &drupal_static(__FUNCTION__, array());
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Check if the active trail has been overridden for this menu tree.
$active_path = menu_tree_get_path($menu_name);
@@ -1278,7 +1278,7 @@ 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 = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Build the cache id; sort parents to prevent duplicate storage and remove
// default parameter values.
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 2e7d41e..dad6f65 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2191,7 +2191,7 @@ function template_preprocess_html(&$variables) {
* @see drupal_render_page()
*/
function template_preprocess_page(&$variables) {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$site_config = \Drupal::config('system.site');
// Move some variables to the top level for themer convenience and template cleanliness.
@@ -2365,7 +2365,7 @@ function theme_get_suggestions($args, $base, $delimiter = '__') {
* @see system_page_build()
*/
function template_preprocess_maintenance_page(&$variables) {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Initializes attributes which are specific to the html element.
$variables['html_attributes'] = new Attribute;
diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index 1ea2bc1..db285d9 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -455,7 +455,7 @@ class Drupal {
* displayed outside the site, such as in an RSS feed.
* - 'language': An optional language object used to look up the alias
* for the URL. If $options['language'] is omitted, the language will be
- * obtained from language(Language::TYPE_URL).
+ * obtained from \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL).
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS
diff --git a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
index 08bdded..2d4be46 100644
--- a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
+++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
@@ -53,7 +53,7 @@ class DrupalDateTime extends DateTimePlus {
public function __construct($time = 'now', $timezone = NULL, $settings = array()) {
// We can set the langcode and country using Drupal values.
if (!isset($settings['langcode'])) {
- $settings['langcode'] = language(Language::TYPE_INTERFACE)->id;
+ $settings['langcode'] = \Drupal::languageManager()->getCurrentLanguage()->id;
}
if (!isset($settings['country'])) {
diff --git a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
index 5c42a81..9903fe3 100644
--- a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
+++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
@@ -13,7 +13,7 @@ use Symfony\Cmf\Component\Routing\VersatileGeneratorInterface;
/**
* Defines an interface for generating a url from a route or system path.
*
- * Provides additional methods and options not present in the base interface.
+ * Provides additional methods and options not present in the base interface.
*/
interface UrlGeneratorInterface extends VersatileGeneratorInterface {
@@ -55,7 +55,7 @@ interface UrlGeneratorInterface extends VersatileGeneratorInterface {
* - 'language': An optional language object. If the path being linked to is
* internal to the site, $options['language'] is used to look up the alias
* for the URL. If $options['language'] is omitted, the language will be
- * obtained from language(Language::TYPE_URL).
+ * obtained from \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL).
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but HTTPS can
@@ -121,8 +121,8 @@ interface UrlGeneratorInterface extends VersatileGeneratorInterface {
* absolute link (beginning with http:). Useful for links that will be
* displayed outside the site, such as in an RSS feed.
* - 'language': An optional language object used to look up the alias
- * for the URL. If $options['language'] is omitted, the language will be
- * obtained from language(Language::TYPE_URL).
+ * for the URL. If $options['language'] is omitted, it defaults to the
+ * current language for the language type Language::TYPE_URL.
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS
diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php
index 23dbeaf..33f91fc 100644
--- a/core/lib/Drupal/Core/Url.php
+++ b/core/lib/Drupal/Core/Url.php
@@ -82,8 +82,8 @@ class Url extends DependencySerialization {
* absolute link (beginning with http:). Useful for links that will be
* displayed outside the site, such as in an RSS feed.
* - 'language': An optional language object used to look up the alias
- * for the URL. If $options['language'] is omitted, the language will be
- * obtained from language(Language::TYPE_URL).
+ * for the URL. If $options['language'] is omitted, it defaults to the
+ * current language for the language type Language::TYPE_URL.
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS
diff --git a/core/lib/Drupal/Core/Validation/DrupalTranslator.php b/core/lib/Drupal/Core/Validation/DrupalTranslator.php
index df14d94..5b4d99d 100644
--- a/core/lib/Drupal/Core/Validation/DrupalTranslator.php
+++ b/core/lib/Drupal/Core/Validation/DrupalTranslator.php
@@ -56,7 +56,7 @@ class DrupalTranslator implements TranslatorInterface {
* Implements \Symfony\Component\Translation\TranslatorInterface::getLocale().
*/
public function getLocale() {
- return $this->locale ? $this->locale : language(Language::TYPE_INTERFACE)->id;
+ return $this->locale ? $this->locale : \Drupal::languageManager()->getCurrentLanguage()->id;
}
/**
diff --git a/core/modules/block/lib/Drupal/block/BlockAccessController.php b/core/modules/block/lib/Drupal/block/BlockAccessController.php
index 9469ffc..4f5182b 100644
--- a/core/modules/block/lib/Drupal/block/BlockAccessController.php
+++ b/core/modules/block/lib/Drupal/block/BlockAccessController.php
@@ -117,7 +117,7 @@ class BlockAccessController extends EntityAccessController implements EntityCont
// Language visibility settings.
if (!empty($visibility['language']['langcodes']) && array_filter($visibility['language']['langcodes'])) {
- if (empty($visibility['language']['langcodes'][language($visibility['language']['language_type'])->id])) {
+ if (empty($visibility['language']['langcodes'][\Drupal::languageManager()->getCurrentLanguage($visibility['language']['language_type'])->id])) {
return FALSE;
}
}
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index b7a8cc7..b201234 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -713,7 +713,7 @@ function template_preprocess_book_navigation(&$variables) {
*/
function template_preprocess_book_export_html(&$variables) {
global $base_url;
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$variables['title'] = String::checkPlain($variables['title']);
$variables['base_url'] = $base_url;
diff --git a/core/modules/book/lib/Drupal/book/BookManager.php b/core/modules/book/lib/Drupal/book/BookManager.php
index 8f3162c..8edd4d7 100644
--- a/core/modules/book/lib/Drupal/book/BookManager.php
+++ b/core/modules/book/lib/Drupal/book/BookManager.php
@@ -552,7 +552,7 @@ class BookManager {
*/
public function bookTreeAllData($menu_name, $link = NULL, $max_depth = NULL) {
$tree = &drupal_static('menu_tree_all_data', array());
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Use $mlid as a flag for whether the data being loaded is for the whole tree.
$mlid = isset($link['mlid']) ? $link['mlid'] : 0;
@@ -721,7 +721,7 @@ class BookManager {
protected function _menu_build_tree($menu_name, array $parameters = array()) {
// Static cache of already built menu trees.
$trees = &drupal_static('menu_build_tree', array());
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Build the cache id; sort parents to prevent duplicate storage and remove
// default parameter values.
diff --git a/core/modules/ckeditor/ckeditor.admin.inc b/core/modules/ckeditor/ckeditor.admin.inc
index d8ef45f..7d763c7 100644
--- a/core/modules/ckeditor/ckeditor.admin.inc
+++ b/core/modules/ckeditor/ckeditor.admin.inc
@@ -20,7 +20,7 @@ use Drupal\Core\Template\Attribute;
*/
function template_preprocess_ckeditor_settings_toolbar(&$variables) {
// Simplify the language direction information for toolbar buttons.
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$language_direction = $language_interface->direction ? 'rtl' : 'ltr';
// Create lists of active and disabled buttons.
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
index 081775f..bd300fc 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
@@ -26,7 +26,7 @@ class CommentTokenReplaceTest extends CommentTestBase {
*/
function testCommentTokenReplacement() {
$token_service = \Drupal::token();
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$url_options = array(
'absolute' => TRUE,
'language' => $language_interface,
diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
index f8f57cf..0678654 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
@@ -141,7 +141,7 @@ class MessageFormController extends ContentEntityFormController {
public function save(array $form, array &$form_state) {
global $user;
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$message = $this->entity;
$sender = clone user_load($user->id());
diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module
index d425866..8c65f1e 100644
--- a/core/modules/content_translation/content_translation.module
+++ b/core/modules/content_translation/content_translation.module
@@ -372,7 +372,7 @@ function content_translation_view_access(EntityInterface $entity, $langcode, Acc
*/
function content_translation_add_access(EntityInterface $entity, Language $source = NULL, Language $target = NULL) {
$source = !empty($source) ? $source : $entity->language();
- $target = !empty($target) ? $target : language(Language::TYPE_CONTENT);
+ $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT);
$translations = $entity->getTranslationLanguages();
$languages = language_list();
return $source->id != $target->id && isset($languages[$source->id]) && isset($languages[$target->id]) && !isset($translations[$target->id]) && content_translation_access($entity, 'create');
@@ -388,7 +388,7 @@ function content_translation_add_access(EntityInterface $entity, Language $sourc
* content language.
*/
function content_translation_edit_access(EntityInterface $entity, Language $language = NULL) {
- $language = !empty($language) ? $language : language(Language::TYPE_CONTENT);
+ $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT);
$translations = $entity->getTranslationLanguages();
$languages = language_list();
return isset($languages[$language->id]) && $language->id != $entity->getUntranslated()->language()->id && isset($translations[$language->id]) && content_translation_access($entity, 'update');
@@ -404,7 +404,7 @@ function content_translation_edit_access(EntityInterface $entity, Language $lang
* content language.
*/
function content_translation_delete_access(EntityInterface $entity, Language $language = NULL) {
- $language = !empty($language) ? $language : language(Language::TYPE_CONTENT);
+ $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT);
$translations = $entity->getTranslationLanguages();
$languages = language_list();
return isset($languages[$language->id]) && $language->id != $entity->getUntranslated()->language()->id && isset($translations[$language->id]) && content_translation_access($entity, 'delete');
diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc
index 0b6a4dc..bed50a0 100644
--- a/core/modules/content_translation/content_translation.pages.inc
+++ b/core/modules/content_translation/content_translation.pages.inc
@@ -184,7 +184,7 @@ function _content_translation_get_switch_links($path) {
*/
function content_translation_add_page(EntityInterface $entity, Language $source = NULL, Language $target = NULL) {
$source = !empty($source) ? $source : $entity->language();
- $target = !empty($target) ? $target : language(Language::TYPE_CONTENT);
+ $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT);
// @todo Exploit the upcoming hook_entity_prepare() when available.
content_translation_prepare_translation($entity, $source, $target);
$form_state['langcode'] = $target->id;
@@ -210,7 +210,7 @@ function content_translation_add_page(EntityInterface $entity, Language $source
* Use \Drupal\content_translation\Controller\ContentTranslationController::edit().
*/
function content_translation_edit_page(EntityInterface $entity, Language $language = NULL) {
- $language = !empty($language) ? $language : language(Language::TYPE_CONTENT);
+ $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT);
$form_state['langcode'] = $language->id;
$form_state['content_translation']['translation_form'] = TRUE;
return \Drupal::service('entity.form_builder')->getForm($entity, 'default', $form_state);
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php
index be3fe85..f1c3ea5 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php
@@ -56,7 +56,7 @@ class ContentTranslationManageAccessCheck implements AccessInterface {
$source = language_load($request->attributes->get('source'));
$target = language_load($request->attributes->get('target'));
$source = !empty($source) ? $source : $entity->language();
- $target = !empty($target) ? $target : language(Language::TYPE_CONTENT);
+ $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT);
return ($source->id != $target->id
&& isset($languages[$source->id])
&& isset($languages[$target->id])
@@ -67,7 +67,7 @@ class ContentTranslationManageAccessCheck implements AccessInterface {
case 'update':
case 'delete':
$language = language_load($request->attributes->get('language'));
- $language = !empty($language) ? $language : language(Language::TYPE_CONTENT);
+ $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT);
return isset($languages[$language->id])
&& $language->id != $entity->getUntranslated()->language()->id
&& isset($translations[$language->id])
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
index 03aedcb..35bb593 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
@@ -26,7 +26,7 @@ class FileTokenReplaceTest extends FileFieldTestBase {
*/
function testFileTokenReplacement() {
$token_service = \Drupal::token();
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Create file field.
$type_name = 'article';
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index 9d23058..f196969 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -402,7 +402,7 @@ function language_get_default_langcode($entity_type, $bundle) {
}
$default_value = NULL;
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
switch ($configuration['langcode']) {
case 'site_default':
$default_value = language_default()->id;
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php
index 5b413f8..adab4ca 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php
@@ -83,7 +83,7 @@ class LanguageConfigurationElementTest extends WebTestBase {
// Current interface.
language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'current_interface', 'language_show' => TRUE));
$langcode = language_get_default_langcode('custom_type', 'custom_bundle');
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$this->assertEqual($langcode, $language_interface->id);
// Site's default.
diff --git a/core/modules/language/tests/language_test/language_test.module b/core/modules/language/tests/language_test/language_test.module
index 3817137..42f2b0f 100644
--- a/core/modules/language/tests/language_test/language_test.module
+++ b/core/modules/language/tests/language_test/language_test.module
@@ -13,8 +13,8 @@ use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI;
*/
function language_test_page_build() {
language_test_store_language_negotiation();
- if (isset(language(Language::TYPE_INTERFACE)->id) && isset(language(Language::TYPE_INTERFACE)->method_id)) {
- drupal_set_message(t('Language negotiation method: @name', array('@name' => language(Language::TYPE_INTERFACE)->method_id)));
+ if (isset(\Drupal::languageManager()->getCurrentLanguage()->id) && isset(\Drupal::languageManager()->getCurrentLanguage()->method_id)) {
+ drupal_set_message(t('Language negotiation method: @name', array('@name' => \Drupal::languageManager()->getCurrentLanguage()->method_id)));
}
}
diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index 105f44e..7c3f570 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -315,7 +315,7 @@ function locale_translatable_language_list() {
* plural formula.
*/
function locale_get_plural($count, $langcode = NULL) {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Used to locally cache the plural formulas for all languages.
$plural_formulas = &drupal_static(__FUNCTION__, array());
@@ -583,7 +583,7 @@ function locale_js_alter(&$javascript) {
* applicable.
*/
function locale_js_translate(array $files = array()) {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$dir = 'public://' . \Drupal::config('locale.settings')->get('javascript.directory');
$parsed = \Drupal::state()->get('system.javascript_parsed') ?: array();
@@ -644,7 +644,7 @@ function locale_library_alter(array &$library, $module, $name) {
// the behavior executes early. JS_LIBRARY is the default.
$library['dependencies'][] = array('locale', 'drupal.locale.datepicker');
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$settings['jquery']['ui']['datepicker'] = array(
'isRTL' => $language_interface->direction == Language::DIRECTION_RTL,
'firstDay' => \Drupal::config('system.date')->get('first_day'),
@@ -820,7 +820,7 @@ function locale_system_file_system_settings_submit(&$form, $form_state) {
*/
function locale_preprocess_node(&$variables) {
if ($variables['node']->language()->id != Language::LANGCODE_NOT_SPECIFIED) {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$node_language = $variables['node']->language();
if ($node_language->id != $language_interface->id) {
@@ -1270,7 +1270,7 @@ function _locale_invalidate_js($langcode = NULL) {
function _locale_rebuild_js($langcode = NULL) {
$config = \Drupal::config('locale.settings');
if (!isset($langcode)) {
- $language = language(Language::TYPE_INTERFACE);
+ $language = \Drupal::languageManager()->getCurrentLanguage();
}
else {
// Get information about the locale.
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index bb851a5..fb29b39 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -336,7 +336,7 @@ function node_type_get_types() {
* An array of node type labels, keyed by the node type name.
*/
function node_type_get_names() {
- $cid = 'node_type:names:' . language(Language::TYPE_INTERFACE)->id;
+ $cid = 'node_type:names:' . \Drupal::languageManager()->getCurrentLanguage()->id;
if ($cache = \Drupal::cache()->get($cid)) {
return $cache->data;
}
@@ -1147,7 +1147,7 @@ function node_block_access($block) {
*/
function node_feed($nids = FALSE, $channel = array()) {
global $base_url;
- $language_content = language(Language::TYPE_CONTENT);
+ $language_content = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT);
$rss_config = \Drupal::config('system.rss');
if ($nids === FALSE) {
diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc
index ec71855..34b235c 100644
--- a/core/modules/search/search.pages.inc
+++ b/core/modules/search/search.pages.inc
@@ -31,7 +31,7 @@ function search_theme_suggestions_search_result(array $variables) {
* - content_attributes: HTML attributes for the content.
*/
function template_preprocess_search_result(&$variables) {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$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 cf162fd..e1bcc90 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -973,7 +973,7 @@ abstract class TestBase {
// Create the database prefix for this test.
$this->prepareDatabasePrefix();
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// When running the test runner within a test, back up the original database
// prefix.
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
index f8fa0fe..712c5ab 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
@@ -25,7 +25,7 @@ class StatisticsTokenReplaceTest extends StatisticsTestBase {
* Creates a node, then tests the statistics tokens generated from it.
*/
function testStatisticsTokenReplacement() {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// 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 8684406..ed6de6c 100644
--- a/core/modules/system/language.api.php
+++ b/core/modules/system/language.api.php
@@ -25,7 +25,7 @@
* The current path.
*/
function hook_language_switch_links_alter(array &$links, $type, $path) {
- $language_interface = language(\Drupal\Core\Language\Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
if ($type == \Drupal\Core\Language\Language::TYPE_CONTENT && isset($links[$language_interface->id])) {
foreach ($links[$language_interface->id] as $link) {
@@ -69,7 +69,7 @@ function hook_language_switch_links_alter(array &$links, $type, $path) {
* Here is a code snippet to transliterate some text:
* @code
* // Use the current default interface language.
- * $langcode = language(\Drupal\Core\Language\Language::TYPE_INTERFACE)->id;
+ * $langcode = \Drupal::languageManager()->getCurrentLanguage()->id;
* // Instantiate the transliteration class.
* $trans = \Drupal::transliteration();
* // Use this to transliterate some text.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
index 4511346..c9ac3bd 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
@@ -96,7 +96,7 @@ class FormatDateTest extends WebTestBase {
function testFormatDate() {
global $user;
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$timestamp = strtotime('2007-03-26T00:00:00+00:00');
$this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', 'Test all parameters.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php
index 927b7b1..025c190 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php
@@ -50,7 +50,7 @@ class MailTest extends WebTestBase implements MailInterface {
* Assert that the pluggable mail system is functional.
*/
public function testPluggableFramework() {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Use MailTestCase for sending a message.
drupal_mail('simpletest', 'mail_test', 'testing@example.com', $language_interface->id);
@@ -65,7 +65,7 @@ class MailTest extends WebTestBase implements MailInterface {
* @see simpletest_mail_alter()
*/
public function testCancelMessage() {
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Reset the class variable holding a copy of the last sent message.
self::$sent_message = NULL;
@@ -81,7 +81,7 @@ class MailTest extends WebTestBase implements MailInterface {
* Checks the From: and Reply-to: headers.
*/
public function testFromAndReplyToHeader() {
- global $language;
+ $language = \Drupal::languageManager()->getCurrentLanguage();
// Reset the class variable holding a copy of the last sent message.
self::$sent_message = NULL;
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index cd5919c..19ea5b1 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -348,7 +348,7 @@ function hook_library_alter(array &$library, $extension, $name) {
// hook_library_info_alter() already.
$library['dependencies'][] = array('locale', 'drupal.locale.datepicker');
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$settings['jquery']['ui']['datepicker'] = array(
'isRTL' => $language_interface->direction == Language::DIRECTION_RTL,
'firstDay' => \Drupal::config('system.date')->get('first_day'),
@@ -1388,7 +1388,7 @@ function hook_template_preprocess_default_variables_alter(&$variables) {
*/
function hook_watchdog(array $log_entry) {
global $base_url;
- $language_interface = language(\Drupal\Core\Language\Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$severity_list = array(
WATCHDOG_EMERGENCY => t('Emergency'),
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 2580688..ef37491 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1334,7 +1334,7 @@ function system_page_build(&$page) {
array(
'path' => current_path(),
'front' => drupal_is_front_page(),
- 'language' => language(\Drupal\Core\Language\Language::TYPE_URL)->id,
+ 'language' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_URL)->id,
'query' => \Drupal::service('request')->query->all(),
)
);
diff --git a/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php
index 9928a57..29634e2 100644
--- a/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php
+++ b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php
@@ -25,6 +25,6 @@ class CachedMockBlockManager extends MockBlockManager {
// The CacheDecorator allows us to cache these plugin definitions for
// quicker retrieval. In this case we are generating a cache key by
// language.
- $this->discovery = new CacheDecorator($this->discovery, 'mock_block:' . language(Language::TYPE_INTERFACE)->id, 'cache', 1542646800, array('plugin_test'));
+ $this->discovery = new CacheDecorator($this->discovery, 'mock_block:' . \Drupal::languageManager()->getCurrentLanguage()->id, 'cache', 1542646800, array('plugin_test'));
}
}
diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php
index a5d617d..931707b 100644
--- a/core/modules/system/theme.api.php
+++ b/core/modules/system/theme.api.php
@@ -258,7 +258,7 @@ function hook_theme_suggestions_HOOK(array $variables) {
*/
function hook_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
// Add an interface-language specific suggestion to all theme hooks.
- $suggestions[] = $hook . '__' . \Drupal::languageManager()->getLanguage()->id;
+ $suggestions[] = $hook . '__' . \Drupal::languageManager()->getCurrentLanguage()->id;
}
/**
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
index e22b97e..eac5f84 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
@@ -66,7 +66,7 @@ class TokenReplaceTest extends TaxonomyTestBase {
*/
function testTaxonomyTokenReplacement() {
$token_service = \Drupal::token();
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Create two taxonomy terms.
$term1 = $this->createTerm($this->vocabulary);
diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php
index 964c664..915e71f 100644
--- a/core/modules/user/lib/Drupal/user/AccountFormController.php
+++ b/core/modules/user/lib/Drupal/user/AccountFormController.php
@@ -72,7 +72,7 @@ abstract class AccountFormController extends ContentEntityFormController {
$user = $this->currentUser();
$config = \Drupal::config('user.settings');
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$register = $account->isAnonymous();
$admin = $user->hasPermission('administer users');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
index cc706ba..d16b4e2 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
@@ -43,7 +43,7 @@ class UserTokenReplaceTest extends WebTestBase {
*/
function testUserTokenReplacement() {
$token_service = \Drupal::token();
- $language_interface = language(Language::TYPE_INTERFACE);
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
$url_options = array(
'absolute' => TRUE,
'language' => $language_interface,
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
index cfad8fe..665b7a5 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
@@ -285,7 +285,7 @@ abstract class CachePluginBase extends PluginBase {
'build_info' => $build_info,
'roles' => $user->getRoles(),
'super-user' => $user->id() == 1, // special caching for super user.
- 'langcode' => language(Language::TYPE_INTERFACE)->id,
+ 'langcode' => \Drupal::languageManager()->getCurrentLanguage()->id,
'base_url' => $GLOBALS['base_url'],
);
$request = \Drupal::request();
@@ -315,7 +315,7 @@ abstract class CachePluginBase extends PluginBase {
'roles' => $user->getRoles(),
'super-user' => $user->id() == 1, // special caching for super user.
'theme' => $GLOBALS['theme'],
- 'langcode' => language(Language::TYPE_INTERFACE)->id,
+ 'langcode' => \Drupal::languageManager()->getCurrentLanguage()->id,
'base_url' => $GLOBALS['base_url'],
);
diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php
index d48f789..faacf8a 100644
--- a/core/modules/views/views.api.php
+++ b/core/modules/views/views.api.php
@@ -341,7 +341,7 @@ function hook_views_query_substitutions(ViewExecutable $view) {
return array(
'***CURRENT_VERSION***' => \Drupal::VERSION,
'***CURRENT_TIME***' => REQUEST_TIME,
- '***CURRENT_LANGUAGE***' => language(\Drupal\Core\Language\Language::TYPE_CONTENT)->id,
+ '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_CONTENT)->id,
'***DEFAULT_LANGUAGE***' => language_default()->id,
);
}
diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc
index 400fcf2..8a55f4b 100644
--- a/core/modules/views/views.theme.inc
+++ b/core/modules/views/views.theme.inc
@@ -1017,7 +1017,7 @@ function template_preprocess_views_view_rss(&$variables) {
$variables['link'] = check_url(url($path, $url_options));
}
- $variables['langcode'] = String::checkPlain(language(Language::TYPE_INTERFACE)->id);
+ $variables['langcode'] = String::checkPlain(\Drupal::languageManager()->getCurrentLanguage()->id);
$variables['namespaces'] = new Attribute($style->namespaces);
$variables['items'] = $items;
$variables['channel_elements'] = format_xml_elements($style->channel_elements);
diff --git a/core/modules/views/views.views_execution.inc b/core/modules/views/views.views_execution.inc
index e730bbb..18039be 100644
--- a/core/modules/views/views.views_execution.inc
+++ b/core/modules/views/views.views_execution.inc
@@ -17,7 +17,7 @@ function views_views_query_substitutions(ViewExecutable $view) {
return array(
'***CURRENT_VERSION***' => \Drupal::VERSION,
'***CURRENT_TIME***' => REQUEST_TIME,
- '***CURRENT_LANGUAGE***' => language(Language::TYPE_CONTENT)->id,
+ '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->id,
'***DEFAULT_LANGUAGE***' => language_default()->id,
);
}