summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc9
-rw-r--r--modules/system/system.admin.inc5
2 files changed, 14 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index a70d26e93..39606404e 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5466,6 +5466,15 @@ function element_sort($a, $b) {
}
/**
+ * 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.
*/
function element_info($type) {
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 8daa45a3c..9839b7554 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',