diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-07-18 07:15:01 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-07-18 07:15:01 +0000 |
commit | 8e60560b8456b278fc4d0e1e6e13583b6b5a3ba2 (patch) | |
tree | d7f345d9e544699a98e2879a11e15a9db226c9ba /install.php | |
parent | e571a2908421fd369f369f41c4dd0a475adef7d4 (diff) | |
download | brdo-8e60560b8456b278fc4d0e1e6e13583b6b5a3ba2.tar.gz brdo-8e60560b8456b278fc4d0e1e6e13583b6b5a3ba2.tar.bz2 |
- Patch #281943 by webchick, Arancaytar, dropcube et al: order install profiles alphabetically.
Diffstat (limited to 'install.php')
-rw-r--r-- | install.php | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/install.php b/install.php index e9ff3aa88..e009632fd 100644 --- a/install.php +++ b/install.php @@ -460,23 +460,42 @@ function install_select_profile() { /** * Form API array definition for the profile selection form. + * + * @param $form_state + * Array of metadata about state of form processing. + * @param $profile_files + * Array of .profile files, as returned from file_scan_directory(). */ -function install_select_profile_form(&$form_state, $profiles) { - foreach ($profiles as $profile) { +function install_select_profile_form(&$form_state, $profile_files) { + $profiles = array(); + $names = array(); + + foreach ($profile_files as $profile) { include_once($profile->filename); - // Load profile details. + + // Load profile details and store them for later retrieval. $function = $profile->name . '_profile_details'; if (function_exists($function)) { $details = $function(); } - // If set, used defined name. Otherwise use file name. + $profiles[$profile->name] = $details; + + // Determine the name of the profile; default to file name if defined name + // is unspecified. $name = isset($details['name']) ? $details['name'] : $profile->name; + $names[$profile->name] = $name; + } + + // Display radio buttons alphabetically by human-readable name. + natcasesort($names); + + foreach ($names as $profile => $name) { $form['profile'][$name] = array( '#type' => 'radio', '#value' => 'default', - '#return_value' => $profile->name, + '#return_value' => $profile, '#title' => $name, - '#description' => isset($details['description']) ? $details['description'] : '', + '#description' => isset($profiles[$profile]['description']) ? $profiles[$profile]['description'] : '', '#parents' => array('profile'), ); } |