You are here

public function Tasks::getFormOptions in Zircon Profile 8.0

Same name in this branch
  1. 8.0 core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::getFormOptions()
  2. 8.0 core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php \Drupal\Core\Database\Driver\sqlite\Install\Tasks::getFormOptions()
  3. 8.0 core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php \Drupal\Core\Database\Driver\pgsql\Install\Tasks::getFormOptions()
  4. 8.0 core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php \Drupal\Core\Database\Driver\mysql\Install\Tasks::getFormOptions()
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::getFormOptions()

Return driver specific configuration options.

Parameters

$database: An array of driver specific configuration options.

Return value

The options form array.

3 calls to Tasks::getFormOptions()
Tasks::getFormOptions in core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
Return driver specific configuration options.
Tasks::getFormOptions in core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
Return driver specific configuration options.
Tasks::getFormOptions in core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php
Return driver specific configuration options.
3 methods override Tasks::getFormOptions()
Tasks::getFormOptions in core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
Return driver specific configuration options.
Tasks::getFormOptions in core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
Return driver specific configuration options.
Tasks::getFormOptions in core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php
Return driver specific configuration options.

File

core/lib/Drupal/Core/Database/Install/Tasks.php, line 209
Contains \Drupal\Core\Database\Install\Tasks.

Class

Tasks
Database installer structure.

Namespace

Drupal\Core\Database\Install

Code

public function getFormOptions(array $database) {
  $form['database'] = array(
    '#type' => 'textfield',
    '#title' => t('Database name'),
    '#default_value' => empty($database['database']) ? '' : $database['database'],
    '#size' => 45,
    '#required' => TRUE,
    '#states' => array(
      'required' => array(
        ':input[name=driver]' => array(
          'value' => $this->pdoDriver,
        ),
      ),
    ),
  );
  $form['username'] = array(
    '#type' => 'textfield',
    '#title' => t('Database username'),
    '#default_value' => empty($database['username']) ? '' : $database['username'],
    '#size' => 45,
    '#required' => TRUE,
    '#states' => array(
      'required' => array(
        ':input[name=driver]' => array(
          'value' => $this->pdoDriver,
        ),
      ),
    ),
  );
  $form['password'] = array(
    '#type' => 'password',
    '#title' => t('Database password'),
    '#default_value' => empty($database['password']) ? '' : $database['password'],
    '#required' => FALSE,
    '#size' => 45,
  );
  $form['advanced_options'] = array(
    '#type' => 'details',
    '#title' => t('Advanced options'),
    '#weight' => 10,
  );
  $profile = drupal_get_profile();
  $db_prefix = $profile == 'standard' ? 'drupal_' : $profile . '_';
  $form['advanced_options']['prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Table name prefix'),
    '#default_value' => empty($database['prefix']) ? '' : $database['prefix'],
    '#size' => 45,
    '#description' => t('If more than one application will be sharing this database, a unique table name prefix – such as %prefix – will prevent collisions.', array(
      '%prefix' => $db_prefix,
    )),
    '#weight' => 10,
  );
  $form['advanced_options']['host'] = array(
    '#type' => 'textfield',
    '#title' => t('Host'),
    '#default_value' => empty($database['host']) ? 'localhost' : $database['host'],
    '#size' => 45,
    // Hostnames can be 255 characters long.
    '#maxlength' => 255,
    '#required' => TRUE,
  );
  $form['advanced_options']['port'] = array(
    '#type' => 'number',
    '#title' => t('Port number'),
    '#default_value' => empty($database['port']) ? '' : $database['port'],
    '#min' => 0,
    '#max' => 65535,
  );
  return $form;
}