diff --git a/core/modules/system/language.api.php b/core/modules/system/language.api.php index ed6de6c..1fb40e2 100644 --- a/core/modules/system/language.api.php +++ b/core/modules/system/language.api.php @@ -5,6 +5,8 @@ * Hooks provided by the base system for language support. */ +use Drupal\Core\Language\LanguageInterface; + /** * @addtogroup hooks * @{ @@ -27,7 +29,7 @@ function hook_language_switch_links_alter(array &$links, $type, $path) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); - if ($type == \Drupal\Core\Language\Language::TYPE_CONTENT && isset($links[$language_interface->id])) { + if ($type == LanguageInterface::TYPE_CONTENT && isset($links[$language_interface->id])) { foreach ($links[$language_interface->id] as $link) { $link['attributes']['class'][] = 'active-language'; } diff --git a/core/modules/text/src/Tests/Formatter/TextPlainUnitTest.php b/core/modules/text/src/Tests/Formatter/TextPlainUnitTest.php index 1c35b24..8725b8a 100644 --- a/core/modules/text/src/Tests/Formatter/TextPlainUnitTest.php +++ b/core/modules/text/src/Tests/Formatter/TextPlainUnitTest.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\DrupalUnitTestBase; /** @@ -92,7 +92,7 @@ function setUp() { )); $this->display->save(); - $this->langcode = Language::LANGCODE_NOT_SPECIFIED; + $this->langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; } /** diff --git a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php index a727ad5..7f20868 100644 --- a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php +++ b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php @@ -7,7 +7,7 @@ namespace Drupal\tracker\Tests\Views; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\views\Tests\ViewTestBase; use Drupal\views\Tests\ViewTestData; @@ -55,7 +55,7 @@ protected function setUp() { 'entity_type' => 'node', 'field_name' => 'comment', 'subject' => $this->randomName(), - 'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20), + 'comment_body[' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20), )); } diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php index 42a2292..1180fac 100644 --- a/core/modules/user/src/AccountForm.php +++ b/core/modules/user/src/AccountForm.php @@ -10,7 +10,7 @@ use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\language\ConfigurableLanguageManagerInterface; use Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin; @@ -253,7 +253,7 @@ public function form(array $form, array &$form_state) { $user_language_added = FALSE; if ($this->languageManager instanceof ConfigurableLanguageManagerInterface) { $negotiator = $this->languageManager->getNegotiator(); - $user_language_added = $negotiator && $negotiator->isNegotiationMethodEnabled(LanguageNegotiationUser::METHOD_ID, Language::TYPE_INTERFACE); + $user_language_added = $negotiator && $negotiator->isNegotiationMethodEnabled(LanguageNegotiationUser::METHOD_ID, LanguageInterface::TYPE_INTERFACE); } $form['language'] = array( '#type' => $this->languageManager->isMultilingual() ? 'details' : 'container', @@ -267,7 +267,7 @@ public function form(array $form, array &$form_state) { $form['language']['preferred_langcode'] = array( '#type' => 'language_select', '#title' => $this->t('Site language'), - '#languages' => Language::STATE_CONFIGURABLE, + '#languages' => LanguageInterface::STATE_CONFIGURABLE, '#default_value' => $user_preferred_langcode, '#description' => $user_language_added ? $this->t("This account's preferred language for e-mails and site presentation.") : $this->t("This account's preferred language for e-mails."), ); @@ -282,7 +282,7 @@ public function form(array $form, array &$form_state) { $form['language']['preferred_admin_langcode'] = array( '#type' => 'language_select', '#title' => $this->t('Administration pages language'), - '#languages' => Language::STATE_CONFIGURABLE, + '#languages' => LanguageInterface::STATE_CONFIGURABLE, '#default_value' => $user_preferred_admin_langcode, '#access' => $show_admin_language, ); diff --git a/core/modules/user/src/Tests/UserEntityTest.php b/core/modules/user/src/Tests/UserEntityTest.php index 43bee29..9621d33 100644 --- a/core/modules/user/src/Tests/UserEntityTest.php +++ b/core/modules/user/src/Tests/UserEntityTest.php @@ -7,7 +7,7 @@ namespace Drupal\user\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\DrupalUnitTestBase; use Drupal\user\Entity\User; @@ -46,7 +46,7 @@ public function testUserMethods() { $role_storage->create(array('id' => 'test_role_two'))->save(); $role_storage->create(array('id' => 'test_role_three'))->save(); - $values = array('roles' => array(Language::LANGCODE_DEFAULT => array('test_role_one'))); + $values = array('roles' => array(LanguageInterface::LANGCODE_DEFAULT => array('test_role_one'))); $user = new User($values, 'user'); $this->assertTrue($user->hasRole('test_role_one')); diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index b960d5b..cecfcc1 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Theme\Registry; use Drupal\views\Plugin\views\area\AreaPluginBase; @@ -1243,7 +1243,7 @@ public function optionsSummary(&$categories, &$options) { $languages = array( '***CURRENT_LANGUAGE***' => t("Current user's language"), '***DEFAULT_LANGUAGE***' => t("Default site language"), - Language::LANGCODE_NOT_SPECIFIED => t('Language neutral'), + LanguageInterface::LANGCODE_NOT_SPECIFIED => t('Language neutral'), ); if (\Drupal::moduleHandler()->moduleExists('language')) { $languages = array_merge($languages, language_list()); @@ -1617,7 +1617,7 @@ public function buildOptionsForm(&$form, &$form_state) { $languages = array( '***CURRENT_LANGUAGE***' => t("Current user's language"), '***DEFAULT_LANGUAGE***' => t("Default site language"), - Language::LANGCODE_NOT_SPECIFIED => t('Language neutral'), + LanguageInterface::LANGCODE_NOT_SPECIFIED => t('Language neutral'), ); $languages = array_merge($languages, views_language_list()); diff --git a/core/modules/views/src/Tests/DefaultViewsTest.php b/core/modules/views/src/Tests/DefaultViewsTest.php index 6e74149..513c3b2 100644 --- a/core/modules/views/src/Tests/DefaultViewsTest.php +++ b/core/modules/views/src/Tests/DefaultViewsTest.php @@ -8,7 +8,7 @@ namespace Drupal\views\Tests; use Drupal\comment\CommentInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; use Drupal\views\ViewExecutable; use Drupal\views\Views; @@ -54,7 +54,7 @@ protected function setUp() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => '', 'nodes' => array('page' => 'page'), 'weight' => mt_rand(0, 10), @@ -164,7 +164,7 @@ function createTerm($vocabulary) { // Use the first available text format. 'format' => $format->format, 'vid' => $vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); return $term; diff --git a/core/modules/views/src/Tests/ViewsTaxonomyAutocompleteTest.php b/core/modules/views/src/Tests/ViewsTaxonomyAutocompleteTest.php index 766ae49..35d5f87 100644 --- a/core/modules/views/src/Tests/ViewsTaxonomyAutocompleteTest.php +++ b/core/modules/views/src/Tests/ViewsTaxonomyAutocompleteTest.php @@ -8,8 +8,8 @@ namespace Drupal\views\Tests; use Drupal\Component\Utility\String; +use Drupal\Core\Language\LanguageInterface; use Drupal\views\Tests\ViewTestBase; -use Drupal\Core\Language\Language; /** * Tests the views taxonomy complete menu callback. @@ -105,7 +105,7 @@ protected function createTerm($name = NULL) { 'name' => $name ?: $this->randomName(), 'description' => $this->randomName(), 'vid' => $this->vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); return $term; diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index f1551e2..ecc9f72 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -5,6 +5,8 @@ * Describes hooks and plugins provided by the Views module. */ +use Drupal\Core\Language\LanguageInterface; + /** * @defgroup views_plugins Views plugins * @@ -341,7 +343,7 @@ function hook_views_query_substitutions(ViewExecutable $view) { return array( '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, - '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_CONTENT)->id, + '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id, '***DEFAULT_LANGUAGE***' => \Drupal::languageManager()->getDefaultLanguage()->id, ); } diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 216bc93..33734c0 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -12,7 +12,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; use Drupal\Core\Database\Query\AlterableInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\views\Plugin\Derivative\ViewsLocalTask; use Drupal\Core\Template\AttributeArray; @@ -515,7 +515,7 @@ function views_add_contextual_links(&$render_element, $location, ViewExecutable * * @see locale_language_list() */ -function views_language_list($field = 'name', $flags = Language::STATE_ALL) { +function views_language_list($field = 'name', $flags = LanguageInterface::STATE_ALL) { $languages = \Drupal::languageManager()->getLanguages($flags); $list = array(); foreach ($languages as $language) { diff --git a/core/modules/views/views.views_execution.inc b/core/modules/views/views.views_execution.inc index d1c040f..96b5006 100644 --- a/core/modules/views/views.views_execution.inc +++ b/core/modules/views/views.views_execution.inc @@ -5,7 +5,7 @@ * Provides views runtime hooks for views.module. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\views\ViewExecutable; /** @@ -17,7 +17,7 @@ function views_views_query_substitutions(ViewExecutable $view) { return array( '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, - '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->id, + '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id, '***DEFAULT_LANGUAGE***' => \Drupal::languageManager()->getDefaultLanguage()->id, ); } diff --git a/core/modules/views_ui/tests/src/ViewUIObjectTest.php b/core/modules/views_ui/tests/src/ViewUIObjectTest.php index 7cbf7b9..f105b3a 100644 --- a/core/modules/views_ui/tests/src/ViewUIObjectTest.php +++ b/core/modules/views_ui/tests/src/ViewUIObjectTest.php @@ -7,7 +7,7 @@ namespace Drupal\views_ui\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Tests\UnitTestCase; use Drupal\views\ViewExecutable; use Drupal\views_ui\ViewUI; @@ -37,7 +37,7 @@ public function testEntityDecoration() { $method_args['setOriginalId'] = array(12); $method_args['setStatus'] = array(TRUE); $method_args['enforceIsNew'] = array(FALSE); - $method_args['label'] = array(Language::LANGCODE_NOT_SPECIFIED); + $method_args['label'] = array(LanguageInterface::LANGCODE_NOT_SPECIFIED); $reflection = new \ReflectionClass('Drupal\Core\Config\Entity\ConfigEntityInterface'); $interface_methods = array();