diff --git a/includes/common.inc b/includes/common.inc index a70d26e93576b22a75b620732ab05fb50c3a0826..39606404e6d0d69167bb2c000b842d422cc493a3 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -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. */ diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index 8daa45a3c95d1ac9f567ce17f8739234a63a57b4..9839b7554b4ba6c8a8288c45d670fb740b53424f 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -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',