diff --git a/core/modules/language/lib/Drupal/language/Plugin/Core/Condition/Language.php b/core/modules/language/lib/Drupal/language/Plugin/Core/Condition/Language.php index b22e5aa..3015c08 100644 --- a/core/modules/language/lib/Drupal/language/Plugin/Core/Condition/Language.php +++ b/core/modules/language/lib/Drupal/language/Plugin/Core/Condition/Language.php @@ -43,10 +43,10 @@ public function buildForm(array $form, array &$form_state) { } $form['langcodes'] = array( '#type' => 'checkboxes', - '#title' => t('Show this block only for specific languages'), + '#title' => t('Language selection'), '#default_value' => !empty($this->configuration['langcodes']) ? $this->configuration['langcodes'] : array(), '#options' => $langcodes_options, - '#description' => t('Show this block only for the selected language(s). If you select no languages, the block will be visibile in all languages.'), + '#description' => t('Return TRUE only for the selected language(s). If no language is selected, this will return TRUE.'), ); } else { @@ -87,9 +87,9 @@ public function summary() { $languages = array_pop($language_names); } if (!empty($this->configuration['negate'])) { - return t('The language is not @languages.', array('@languages' => $languages,)); + return t('The language is not @languages.', array('@languages' => $languages)); } - return t('The language is @languages.', array('@languages' => $languages,)); + return t('The language is @languages.', array('@languages' => $languages)); } /** diff --git a/core/modules/language/lib/Drupal/language/Tests/Condition/LanguageConditionTest.php b/core/modules/language/lib/Drupal/language/Tests/Condition/LanguageConditionTest.php index e1f920a..e98a8d3 100644 --- a/core/modules/language/lib/Drupal/language/Tests/Condition/LanguageConditionTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/Condition/LanguageConditionTest.php @@ -65,7 +65,6 @@ protected function setUp() { language_save($language); $this->manager = $this->container->get('plugin.manager.condition'); - $this->languageManager = $this->container->get('language_manager'); } /** @@ -74,9 +73,10 @@ protected function setUp() { public function testConditions() { // Grab the language condition and configure it to check the content // language. + $language = language_load('en'); $condition = $this->manager->createInstance('language') ->setConfig('langcodes', array('en' => 'en', 'it' => 'it')) - ->setContextValue('language', language(LANGUAGE_TYPE_CONTENT)); + ->setContextValue('language', $language); $this->assertTrue($condition->execute(), 'Language condition passes as expected.'); // Check for the proper summary. $this->assertEqual($condition->summary(), 'The language is English, Italian.'); @@ -94,20 +94,11 @@ public function testConditions() { $this->assertEqual($condition->summary(), 'The language is not Italian.'); // Change the default language to Italian. - $this->languageManager->reset(); - variable_set('language_default', array( - 'langcode' => 'it', - 'name' => 'Italian', - 'direction' => 0, - 'weight' => 0, - 'locked' => 0, - )); - $this->languageManager->init(); + $language = language_load('it'); - // Use the language interface now. $condition = $this->manager->createInstance('language') ->setConfig('langcodes', array('en' => 'en', 'it' => 'it')) - ->setContextValue('language', language(LANGUAGE_TYPE_INTERFACE)); + ->setContextValue('language', $language); $this->assertTrue($condition->execute(), 'Language condition passes as expected.'); // Check for the proper summary.