diff --git includes/install.core.inc includes/install.core.inc index 52ef593..c92b12f 100644 --- includes/install.core.inc +++ includes/install.core.inc @@ -1010,9 +1010,25 @@ function install_select_profile(&$install_state) { // yet), rather just a convenience method for setting parameters in the // URL. if ($install_state['interactive']) { + $profiles = array(); + $details = array(); + foreach ($install_state['profiles'] as $profile) { + $info = install_profile_info($profile->name); + // Don't show hidden profiles. This is used by to hide the testing profile, + // which only exists to speed up test runs. + if ($info['hidden'] === TRUE) { + continue; + } + $details[$profile->name] = $info; + $profiles[$profile->name] = $profile; + } + if (count($profiles) == 1) { + // Skip the form since there is only one that's visible. + install_goto('install.php?profile=' . $profile->name); + } include_once DRUPAL_ROOT . '/includes/form.inc'; drupal_set_title(st('Select an installation profile')); - $form = drupal_get_form('install_select_profile_form', $install_state['profiles']); + $form = drupal_get_form('install_select_profile_form', $profiles, $details); return drupal_render($form); } else { @@ -1057,25 +1073,15 @@ function _install_select_profile($profiles) { * @param $profile_files * Array of .profile files, as returned from file_scan_directory(). */ -function install_select_profile_form($form, &$form_state, $profile_files) { - $profiles = array(); +function install_select_profile_form($form, &$form_state, $profiles, $details) { $names = array(); - foreach ($profile_files as $profile) { + foreach ($profiles as $profile) { // TODO: is this right? include_once DRUPAL_ROOT . '/' . $profile->uri; - - $details = install_profile_info($profile->name); - // Don't show hidden profiles. This is used by to hide the testing profile, - // which only exists to speed up test runs. - if ($details['hidden'] === TRUE) { - continue; - } - $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; + $name = isset($details[$profile->name]['name']) ? $details[$profile->name]['name'] : $profile->name; $names[$profile->name] = $name; } @@ -1096,13 +1102,13 @@ function install_select_profile_form($form, &$form_state, $profile_files) { $names = array('standard' => $names['standard']) + $names; } - foreach ($names as $profile => $name) { + foreach ($names as $name => $readable_name) { $form['profile'][$name] = array( '#type' => 'radio', '#value' => 'standard', - '#return_value' => $profile, - '#title' => $name, - '#description' => isset($profiles[$profile]['description']) ? $profiles[$profile]['description'] : '', + '#return_value' => $name, + '#title' => $readable_name, + '#description' => isset($details[$name]['description']) ? $details[$name]['description'] : '', '#parents' => array('profile'), ); }