1 install.core.inc install_select_profile(&$install_state)

Selects which profile to install.

Parameters

array $install_state: An array of information about the current installation state. The chosen profile will be added here, if it was not already selected previously, as will a list of all available profiles.

Return value

string: For interactive installations, a form allowing the profile to be selected, if the user has a choice that needs to be made. Otherwise, an exception is thrown if a profile cannot be chosen automatically.

Throws

Exception

File

core/includes/install.core.inc, line 1124
API functions for installing Backdrop.

Code

function install_select_profile(&$install_state) {
  if (empty($install_state['parameters']['profile'])) {
    // Try to find a profile.
    $profile = _install_select_profile($install_state['profiles']);
    if (empty($profile)) {
      // We still don't have a profile, so display a form for selecting one.
      // Only do this in the case of interactive installations, since this is
      // not a real form with submit handlers (the database isn't even set up
      // yet), rather just a convenience method for setting parameters in the
      // URL.
      if ($install_state['interactive']) {
        include_once BACKDROP_ROOT . '/core/includes/form.inc';
        backdrop_set_title(st('Select an installation profile'));
        $form = backdrop_get_form('install_select_profile_form', $install_state['profiles']);
        return backdrop_render($form);
      }
      else {
        throw new Exception(install_no_profile_error());
      }
    }
    else {
      $install_state['parameters']['profile'] = $profile;
    }
  }
}