You are here

function install_select_profile_form in Drupal 6

Same name and namespace in other branches
  1. 5 install.php \install_select_profile_form()
  2. 7 includes/install.core.inc \install_select_profile_form()

Form API array definition for the profile selection form.

Parameters

$form_state: Array of metadata about state of form processing.

$profile_files: Array of .profile files, as returned from file_scan_directory().

1 string reference to 'install_select_profile_form'
install_select_profile in ./install.php
Allow admin to select which profile to install.

File

./install.php, line 476

Code

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 and store them for later retrieval.
    $function = $profile->name . '_profile_details';
    if (function_exists($function)) {
      $details = $function();
    }
    $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,
      '#title' => $name,
      '#description' => isset($profiles[$profile]['description']) ? $profiles[$profile]['description'] : '',
      '#parents' => array(
        'profile',
      ),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => st('Save and continue'),
  );
  return $form;
}