From 14d65ce19eb2a9c8b02a711567f6b7e42e426f1f Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 5 Sep 2010 15:38:16 +0000 Subject: [PATCH] #800502 by Damien Tournoud, sun: Fixed Module page is not ordered correctly. --- includes/common.inc | 9 +++++++++ modules/system/system.admin.inc | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/includes/common.inc b/includes/common.inc index a70d26e9357..39606404e6d 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 8daa45a3c95..9839b7554b4 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',