DatabaseTasks::getFormOptions

public function DatabaseTasks::getFormOptions

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

includes/install.inc, line 478
API functions for installing modules and themes.

Class

DatabaseTasks
Database installer structure.

Code

public function getFormOptions($database) {
  $form['database'] = array(
    '#type' => 'textfield',
    '#title' => st('Database name'),
    '#default_value' => empty($database['database']) ? '' : $database['database'],
    '#size' => 45,
    '#required' => TRUE,
    '#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_distribution_name())),
  );

  $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,
  );

  $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 = drupal_get_profile();
  $db_prefix = ($profile == 'standard') ? 'drupal_' : $profile . '_';
  $form['advanced_options']['db_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 @drupal site here.', array('@drupal' => drupal_install_profile_distribution_name(), '%prefix' => $db_prefix)),
    '#weight' => 10,
  );

  $form['advanced_options']['host'] = array(
    '#type' => 'textfield',
    '#title' => st('Database host'),
    '#default_value' => empty($database['host']) ? 'localhost' : $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' => 'textfield',
    '#title' => st('Database port'),
    '#default_value' => empty($database['port']) ? '' : $database['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.'),
  );

  return $form;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!install.inc/function/DatabaseTasks::getFormOptions/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部