summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2012-06-16 13:17:16 (GMT)
committerwebchick2012-06-16 13:17:16 (GMT)
commit47055769064343a373480226f489d09d0e5dca12 (patch)
tree998fcdbf1bb0fbe966b49f71aeb9690ae9a79580
parentf772c1095aad9b3038e7bc444458d50d370aca8e (diff)
Issue #1637710 by Schnitzel, vasi1186: Fixed Pass on language weight to language_locked_languages() when available.
-rw-r--r--core/includes/bootstrap.inc12
-rw-r--r--core/includes/update.inc3
-rw-r--r--core/modules/language/language.install4
3 files changed, 10 insertions, 9 deletions
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index dc4a3d4..fa1335b 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -2691,9 +2691,9 @@ function language_list($all = FALSE) {
else {
// No language module, so use the default language only.
$languages = array($default->langcode => $default);
+ // Add the special languages, they will be filtered later if needed.
+ $languages += language_locked_languages($default->weight);
}
- // Add the special languages, they will be filtered later if needed.
- $languages += language_locked_languages();
}
// Filter the full list of languages based on the value of the $all flag. By
@@ -2720,7 +2720,7 @@ function language_list($all = FALSE) {
* @return
* An array of language objects.
*/
-function language_locked_languages($weight = 20) {
+function language_locked_languages($weight = 0) {
$locked_language = array(
'default' => FALSE,
'locked' => TRUE,
@@ -2731,17 +2731,17 @@ function language_locked_languages($weight = 20) {
$languages[LANGUAGE_NOT_SPECIFIED] = new Language(array(
'langcode' => LANGUAGE_NOT_SPECIFIED,
'name' => t('Not specified'),
- 'weight' => $weight++,
+ 'weight' => ++$weight,
) + $locked_language);
$languages[LANGUAGE_NOT_APPLICABLE] = new Language(array(
'langcode' => LANGUAGE_NOT_APPLICABLE,
'name' => t('Not applicable'),
- 'weight' => $weight++,
+ 'weight' => ++$weight,
) + $locked_language);
$languages[LANGUAGE_MULTIPLE] = new Language(array(
'langcode' => LANGUAGE_MULTIPLE,
'name' => t('Multiple'),
- 'weight' => $weight++,
+ 'weight' => ++$weight,
) + $locked_language);
return $languages;
}
diff --git a/core/includes/update.inc b/core/includes/update.inc
index 1dcb8e7..49df15b 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -234,7 +234,8 @@ function update_prepare_d8_language() {
);
db_add_field('language', 'locked', $locked_spec);
- $languages = language_locked_languages();
+ $max_language_weight = db_query('SELECT MAX(weight) FROM {language}')->fetchField();
+ $languages = language_locked_languages($max_language_weight);
foreach ($languages as $language) {
db_insert('language')
->fields(array(
diff --git a/core/modules/language/language.install b/core/modules/language/language.install
index 1a1560b..b07753b 100644
--- a/core/modules/language/language.install
+++ b/core/modules/language/language.install
@@ -14,8 +14,8 @@
function language_install() {
// Add the default language at first so that language_list() returns this in
// language_special_languages().
- language_save(language_default());
- $languages = language_locked_languages();
+ $default_language = language_save(language_default());
+ $languages = language_locked_languages($default_language->weight);
foreach ($languages as $language) {
language_save($language);
}