Commit 5d0729f0 authored by webchick's avatar webchick

Issue #2070369 by herom, bdgreen, Mac_Weber, InternetDevels, sidharthap,...

Issue #2070369 by herom, bdgreen, Mac_Weber, InternetDevels, sidharthap, JeroenT: Remove all calls to deprecated function language().
parent 57661ff9
......@@ -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";
......
......@@ -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;
}
......
......@@ -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(
......
......@@ -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.
......
......@@ -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;
......
......@@ -455,7 +455,7 @@ public static function urlGenerator() {
* 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
......
......@@ -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'])) {
......
......@@ -13,7 +13,7 @@
/**
* 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 @@ public function getPathFromRoute($name, $parameters = array());
* 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
......
......@@ -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
......
......@@ -56,7 +56,7 @@ public function setLocale($locale) {
* 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;
}
/**
......
......@@ -117,7 +117,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
// 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;
}
}
......
......@@ -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;
......
......@@ -552,7 +552,7 @@ public function deleteBook($nid) {
*/
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 @@ protected function menu_build_tree($menu_name, array $parameters = array()) {
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.
......
......@@ -20,7 +20,7 @@
*/
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.
......
......@@ -26,7 +26,7 @@ public static function getInfo() {
*/
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,
......
......@@ -141,7 +141,7 @@ public function preview(array $form, array &$form_state) {
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());
......
......@@ -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');
......
......@@ -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);
......
......@@ -56,7 +56,7 @@ public function access(Route $route, Request $request, AccountInterface $account
$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 @@ public function access(Route $route, Request $request, AccountInterface $account
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])
......
......@@ -26,7 +26,7 @@ public static function getInfo() {
*/
function testFileTokenReplacement() {
$token_service = \Drupal::token();
$language_interface = language(Language::TYPE_INTERFACE);
$language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Create file field.
$type_name = 'article';
......
......@@ -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;
......
......@@ -83,7 +83,7 @@ public function testDefaultLangcode() {
// 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.
......
......@@ -13,8 +13,8 @@
*/
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)));
}
}
......
......@@ -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.
......
......@@ -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) {
......
......@@ -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']);
......
......@@ -973,7 +973,7 @@ private function prepareEnvironment() {
// 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.
......
......@@ -25,7 +25,7 @@ public static function getInfo() {
* 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'));
......
......@@ -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.
......
......@@ -96,7 +96,7 @@ function testAdminDefinedFormatDate() {
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.');
......
......@@ -50,7 +50,7 @@ function setUp() {
* 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 @@ public function testPluggableFramework() {
* @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 @@ public function testCancelMessage() {
* 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;
......
......@@ -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'),
......
......@@ -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(),
)
);
......
......@@ -25,6 +25,6 @@ public function __construct() {
// 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'));
}
}
......@@ -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;
}
/**
......
......@@ -66,7 +66,7 @@ function setUp() {
*/
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);
......
......@@ -72,7 +72,7 @@ public function form(array $form, array &$form_state) {
$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');
......
......@@ -43,7 +43,7 @@ public function setUp() {
*/
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,
......
......@@ -285,7 +285,7 @@ public function generateResultsKey() {
'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 @@ public function generateOutputKey() {
'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'],
);
......
......@@ -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,
);
}
......
......@@ -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);
......
......@@ -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,
);
}
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