#800502 by Damien Tournoud, sun: Fixed Module page is not ordered correctly.

merge-requests/26/head
Angie Byron 2010-09-05 15:38:16 +00:00
parent fb9c1df0b9
commit 14d65ce19e
2 changed files with 14 additions and 0 deletions

View File

@ -5465,6 +5465,15 @@ function element_sort($a, $b) {
return ($a_weight < $b_weight) ? -1 : 1;
}
/**
* Array sorting callback; sorts elements by title.
*/
function element_sort_by_title($a, $b) {
$a_title = (is_array($a) && isset($a['#title'])) ? $a['#title'] : '';
$b_title = (is_array($b) && isset($b['#title'])) ? $b['#title'] : '';
return strnatcasecmp($a_title, $b_title);
}
/**
* Retrieve the default properties for the defined element type.
*/

View File

@ -959,9 +959,14 @@ function system_modules($form, $form_state = array()) {
t('Description'),
array('data' => t('Operations'), 'colspan' => 3),
),
// Ensure that the "Core" package fieldset comes first.
'#weight' => $package == 'Core' ? -10 : NULL,
);
}
// Lastly, sort all fieldsets by title.
uasort($form['modules'], 'element_sort_by_title');
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',