function install_settings_form
7.x install.core.inc | install_settings_form( |
6.x install.php | install_settings_form(&$form_state, $profile, $install_locale, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host, $db_port, $db_path) |
Form API array definition for install_settings.
1 string reference to 'install_settings_form'
- install_change_settings in drupal-6.x/
install.php - Configure and rewrite settings.php.
File
- drupal-6.x/
install.php, line 230
Code
function install_settings_form(&$form_state, $profile, $install_locale, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host, $db_port, $db_path) {
if (empty($db_host)) {
$db_host = 'localhost';
}
$db_types = drupal_detect_database_types();
// If both 'mysql' and 'mysqli' are available, we disable 'mysql':
if (isset($db_types['mysqli'])) {
unset($db_types['mysql']);
}
if (count($db_types) == 0) {
$form['no_db_types'] = array(
'#value' => st('Your web server does not appear to support any common database types. Check with your hosting provider to see if they offer any databases that <a href="@drupal-databases">Drupal supports</a>.', array('@drupal-databases' => 'http://drupal.org/node/270#database')),
);
}
else {
$form['basic_options'] = array(
'#type' => 'fieldset',
'#title' => st('Basic options'),
'#description' => '<p>' . st('To set up your @drupal database, enter the following information.', array('@drupal' => drupal_install_profile_name())) . '</p>',
);
if (count($db_types) > 1) {
$form['basic_options']['db_type'] = array(
'#type' => 'radios',
'#title' => st('Database type'),
'#required' => TRUE,
'#options' => $db_types,
'#default_value' => ($db_type ? $db_type : current($db_types)),
'#description' => st('The type of database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_name())),
);
$db_path_description = st('The name of the database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('@drupal' => drupal_install_profile_name()));
}
else {
if (count($db_types) == 1) {
$db_types = array_values($db_types);
$form['basic_options']['db_type'] = array(
'#type' => 'hidden',
'#value' => $db_types[0],
);
$db_path_description = st('The name of the %db_type database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('%db_type' => $db_types[0], '@drupal' => drupal_install_profile_name()));
}
}
// Database name
$form['basic_options']['db_path'] = array(
'#type' => 'textfield',
'#title' => st('Database name'),
'#default_value' => $db_path,
'#size' => 45,
'#required' => TRUE,
'#description' => $db_path_description
);
// Database username
$form['basic_options']['db_user'] = array(
'#type' => 'textfield',
'#title' => st('Database username'),
'#default_value' => $db_user,
'#size' => 45,
'#required' => TRUE,
);
// Database username
$form['basic_options']['db_pass'] = array(
'#type' => 'password',
'#title' => st('Database password'),
'#default_value' => $db_pass,
'#size' => 45,
);
$form['advanced_options'] = array(
'#type' => 'fieldset',
'#title' => st('Advanced options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => st("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider.")
);
// Database host
$form['advanced_options']['db_host'] = array(
'#type' => 'textfield',
'#title' => st('Database host'),
'#default_value' => $db_host,
'#size' => 45,
// Hostnames can be 255 characters long.
'#maxlength' => 255,
'#required' => TRUE,
'#description' => st('If your database is located on a different server, change this.'),
);
// Database port
$form['advanced_options']['db_port'] = array(
'#type' => 'textfield',
'#title' => st('Database port'),
'#default_value' => $db_port,
'#size' => 45,
// The maximum port number is 65536, 5 digits.
'#maxlength' => 5,
'#description' => st('If your database server is listening to a non-standard port, enter its number.'),
);
// Table prefix
$prefix = ($profile == 'default') ? 'drupal_' : $profile . '_';
$form['advanced_options']['db_prefix'] = array(
'#type' => 'textfield',
'#title' => st('Table prefix'),
'#default_value' => $db_prefix,
'#size' => 45,
'#description' => st('If more than one application will be sharing this database, enter a table prefix such as %prefix for your @drupal site here.', array('@drupal' => drupal_install_profile_name(), '%prefix' => $prefix)),
);
$form['save'] = array(
'#type' => 'submit',
'#value' => st('Save and continue'),
);
$form['errors'] = array();
$form['settings_file'] = array('#type' => 'value', '#value' => $settings_file);
$form['_db_url'] = array('#type' => 'value');
$form['#action'] = "install.php?profile=$profile" . ($install_locale ? "&locale=$install_locale" : '');
$form['#redirect'] = FALSE;
}
return $form;
}