Commit 47055769 authored by webchick's avatar webchick

Issue #1637710 by Schnitzel, vasi1186: Fixed Pass on language weight to...

Issue #1637710 by Schnitzel, vasi1186: Fixed Pass on language weight to language_locked_languages() when available.
parent f772c109
......@@ -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;
}
......
......@@ -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(
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment