summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-10-07 11:45:13 (GMT)
committerAlex Pott2014-10-07 11:45:13 (GMT)
commitc52c5f9ace2dea9824c53d0380859c94d323ccb2 (patch)
treeae4cd1ac82710072596d4ea9a7c4f228c200f2ed
parent6ef8ba79091ba8ef07008a68ae11c8fcde7d1958 (diff)
Issue #2304403 by martin107, YesCT, Désiré: Convert language:weight into a protected property.
-rw-r--r--core/includes/update.inc2
-rw-r--r--core/lib/Drupal/Core/Language/Language.php2
-rw-r--r--core/lib/Drupal/Core/Language/LanguageManager.php2
-rw-r--r--core/modules/language/src/ConfigurableLanguageManager.php6
-rw-r--r--core/modules/language/src/Entity/ConfigurableLanguage.php2
-rw-r--r--core/modules/language/src/Tests/LanguageConfigurationTest.php7
6 files changed, 11 insertions, 10 deletions
diff --git a/core/includes/update.inc b/core/includes/update.inc
index b6d07f4..22baff9 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -733,7 +733,7 @@ function update_language_list($flags = LanguageInterface::STATE_CONFIGURABLE) {
// No language module, so use the default language only.
$languages = array($default->id => $default);
// Add the special languages, they will be filtered later if needed.
- $languages += \Drupal::languageManager()->getDefaultLockedLanguages($default->weight);
+ $languages += \Drupal::languageManager()->getDefaultLockedLanguages($default->getWeight());
}
}
diff --git a/core/lib/Drupal/Core/Language/Language.php b/core/lib/Drupal/Core/Language/Language.php
index b04f60f..0158eb8 100644
--- a/core/lib/Drupal/Core/Language/Language.php
+++ b/core/lib/Drupal/Core/Language/Language.php
@@ -57,7 +57,7 @@ class Language implements LanguageInterface {
*
* @var int
*/
- public $weight = 0;
+ protected $weight = 0;
/**
* Locked indicates a language used by the system, not an actual language.
diff --git a/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php
index ea7f830..6fe99d6 100644
--- a/core/lib/Drupal/Core/Language/LanguageManager.php
+++ b/core/lib/Drupal/Core/Language/LanguageManager.php
@@ -135,7 +135,7 @@ class LanguageManager implements LanguageManagerInterface {
$default = $this->getDefaultLanguage();
$this->languages = array($default->id => $default);
// Add the special languages, they will be filtered later if needed.
- $this->languages += $this->getDefaultLockedLanguages($default->weight);
+ $this->languages += $this->getDefaultLockedLanguages($default->getWeight());
}
// Filter the full list of languages based on the value of the $all flag. By
diff --git a/core/modules/language/src/ConfigurableLanguageManager.php b/core/modules/language/src/ConfigurableLanguageManager.php
index 6699ab0..dbb68d2 100644
--- a/core/modules/language/src/ConfigurableLanguageManager.php
+++ b/core/modules/language/src/ConfigurableLanguageManager.php
@@ -298,7 +298,7 @@ class ConfigurableLanguageManager extends LanguageManager implements Configurabl
$data['default'] = ($langcode == $default->id);
$data['name'] = $data['label'];
$this->languages[$langcode] = new Language($data);
- $weight = max(array($weight, $this->languages[$langcode]->weight));
+ $weight = max(array($weight, $this->languages[$langcode]->getWeight()));
}
// Add locked languages, they will be filtered later if needed.
@@ -337,8 +337,8 @@ class ConfigurableLanguageManager extends LanguageManager implements Configurabl
// Get maximum weight to update the system languages to keep them on bottom.
foreach ($this->getLanguages(LanguageInterface::STATE_CONFIGURABLE) as $language) {
- if (!$language->isLocked() && $language->weight > $max_weight) {
- $max_weight = $language->weight;
+ if (!$language->isLocked() && $language->getWeight() > $max_weight) {
+ $max_weight = $language->getWeight();
}
}
diff --git a/core/modules/language/src/Entity/ConfigurableLanguage.php b/core/modules/language/src/Entity/ConfigurableLanguage.php
index 1235b8a..6fcf874 100644
--- a/core/modules/language/src/Entity/ConfigurableLanguage.php
+++ b/core/modules/language/src/Entity/ConfigurableLanguage.php
@@ -71,7 +71,7 @@ class ConfigurableLanguage extends ConfigEntityBase implements ConfigurableLangu
*
* @var integer
*/
- public $weight = 0;
+ protected $weight = 0;
/**
* Locked languages cannot be edited.
diff --git a/core/modules/language/src/Tests/LanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageConfigurationTest.php
index d7cc61f..ce8c7cf 100644
--- a/core/modules/language/src/Tests/LanguageConfigurationTest.php
+++ b/core/modules/language/src/Tests/LanguageConfigurationTest.php
@@ -157,7 +157,7 @@ class LanguageConfigurationTest extends WebTestBase {
$replacements = array('@event' => $state);
foreach (\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_LOCKED) as $locked_language) {
$replacements['%language'] = $locked_language->name;
- $this->assertTrue($locked_language->weight > $max_configurable_language_weight, format_string('System language %language has higher weight than configurable languages @event', $replacements));
+ $this->assertTrue($locked_language->getWeight() > $max_configurable_language_weight, format_string('System language %language has higher weight than configurable languages @event', $replacements));
}
}
@@ -170,10 +170,11 @@ class LanguageConfigurationTest extends WebTestBase {
protected function getHighestConfigurableLanguageWeight(){
$max_weight = 0;
+ /* @var $languages \Drupal\Core\Language\LanguageInterface[] */
$languages = entity_load_multiple('configurable_language', NULL, TRUE);
foreach ($languages as $language) {
- if (!$language->isLocked() && $language->weight > $max_weight) {
- $max_weight = $language->weight;
+ if (!$language->isLocked() && $language->getWeight() > $max_weight) {
+ $max_weight = $language->getWeight();
}
}