diff --git a/core/modules/node/src/Tests/Views/NodeLanguageTest.php b/core/modules/node/src/Tests/Views/NodeLanguageTest.php index b562b14..0947a1e 100644 --- a/core/modules/node/src/Tests/Views/NodeLanguageTest.php +++ b/core/modules/node/src/Tests/Views/NodeLanguageTest.php @@ -7,9 +7,9 @@ namespace Drupal\node\Tests\Views; -use Drupal\Core\Language\LanguageInterface; use Drupal\field\Entity\FieldStorageConfig; use Drupal\language\Entity\ConfigurableLanguage; +use Drupal\views\Plugin\views\PluginBase; /** * Tests node language fields, filters, and sorting. @@ -181,7 +181,7 @@ public function testLanguages() { // filter is set to the site default language instead. This should just // show the English nodes, no matter what the content language is. $config = \Drupal::config('views.view.frontpage'); - $config->set('display.default.display_options.filters.langcode.value', array('***LANGUAGE_' . LanguageInterface::LANGCODE_SITE_DEFAULT . '***' => '***LANGUAGE_' . LanguageInterface::LANGCODE_SITE_DEFAULT . '***')); + $config->set('display.default.display_options.filters.langcode.value', array(PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT => PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT)); $config->save(); foreach ($this->node_titles as $langcode => $titles) { $this->drupalGet(($langcode == 'en' ? '' : "$langcode/") . 'node'); diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php index 5a088d1..7363d28 100644 --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -415,7 +415,7 @@ protected function listLanguages($flags = LanguageInterface::STATE_ALL) { $languages = $manager->getLanguages($flags); foreach ($languages as $id => $language) { if ($id == LanguageInterface::LANGCODE_SITE_DEFAULT) { - $id = '***LANGUAGE_' . $id . '***'; + $id = PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT; } $list[$id] = t($language->name); } @@ -455,7 +455,7 @@ public static function queryLanguageSubstitutions() { // Handle default language. $default = $manager->getDefaultLanguage()->id; - $changes['***LANGUAGE_' . LanguageInterface::LANGCODE_SITE_DEFAULT . '***'] = $default; + $changes[PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT] = $default; // Handle negotiated languages. $types = $manager->getDefinedLanguageTypesInfo(); diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index 65283f1..3f73e63 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -6,6 +6,7 @@ */ use Drupal\Core\Language\LanguageInterface; +use Drupal\views\Plugin\views\PluginBase; /** * @defgroup views_overview Views overview @@ -579,7 +580,7 @@ function hook_views_query_substitutions(ViewExecutable $view) { '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, '***LANGUAGE_language_content***' => \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id, - '***LANGUAGE_' . LanguageInterface::LANGCODE_SITE_DEFAULT . '***' => \Drupal::languageManager()->getDefaultLanguage()->id, + PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT => \Drupal::languageManager()->getDefaultLanguage()->id, ); }