1 install.inc | public DatabaseTasks::getFormOptions($database) |
Return driver specific configuration options.
Parameters
$database: An array of driver specific configuration options.
Return value
The options form array.:
File
- core/
includes/ install.inc, line 588 - API functions for installing modules and themes.
Class
- DatabaseTasks
- Database installer structure.
Code
public function getFormOptions($database) {
$form['database'] = array(
'#type' => 'textfield',
'#title' => st('MySQL Database name'),
'#default_value' => empty($database['database']) ? '' : $database['database'],
'#size' => 45,
'#required' => TRUE,
);
$form['username'] = array(
'#type' => 'textfield',
'#title' => st('Database username'),
'#default_value' => empty($database['username']) ? '' : $database['username'],
'#required' => TRUE,
'#size' => 45,
);
$form['password'] = array(
'#type' => 'password',
'#title' => st('Database password'),
'#default_value' => empty($database['password']) ? '' : $database['password'],
'#required' => FALSE,
'#size' => 45,
'#password_toggle' => TRUE,
);
$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."),
'#weight' => 10,
);
$profile = backdrop_get_profile();
$prefix = ($profile == 'standard') ? 'backdrop_' : $profile . '_';
$form['advanced_options']['prefix'] = array(
'#type' => 'textfield',
'#title' => st('Table prefix'),
'#default_value' => '',
'#size' => 45,
'#description' => st('If more than one application will be sharing this database, enter a table prefix such as %prefix for your @profile site here.', array(
'@profile' => backdrop_install_profile_distribution_name(),
'%prefix' => $prefix,
)),
'#weight' => 10,
);
$form['advanced_options']['host'] = array(
'#type' => 'textfield',
'#title' => st('Database host'),
'#default_value' => empty($database['host']) ? '127.0.0.1' : $database['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.'),
);
$form['advanced_options']['port'] = array(
'#type' => 'number',
'#title' => st('Database port'),
'#default_value' => empty($database['port']) ? '' : $database['port'],
'#min' => 1,
'#max' => 65535,
'#description' => st('If your database server is listening to a non-standard port, enter its number.'),
);
return $form;
}