function install_select_profile

Same name in other branches
  1. 9 core/includes/install.core.inc \install_select_profile()
  2. 8.9.x core/includes/install.core.inc \install_select_profile()
  3. 10 core/includes/install.core.inc \install_select_profile()
  4. 11.x core/includes/install.core.inc \install_select_profile()

Selects which profile to install.

Parameters

$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

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.

File

includes/install.core.inc, line 1052

Code

function install_select_profile(&$install_state) {
    $install_state['profiles'] += install_find_profiles();
    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 DRUPAL_ROOT . '/includes/form.inc';
                drupal_set_title(st('Select an installation profile'));
                $form = drupal_get_form('install_select_profile_form', $install_state['profiles']);
                return drupal_render($form);
            }
            else {
                throw new Exception(install_no_profile_error());
            }
        }
        else {
            $install_state['parameters']['profile'] = $profile;
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.