You are here

public function Tasks::getFormOptions in Drupal 10

Same name in this branch
  1. 10 core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::getFormOptions()
  2. 10 core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php \Drupal\sqlite\Driver\Database\sqlite\Install\Tasks::getFormOptions()
  3. 10 core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php \Drupal\pgsql\Driver\Database\pgsql\Install\Tasks::getFormOptions()
  4. 10 core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php \Drupal\mysql\Driver\Database\mysql\Install\Tasks::getFormOptions()

Returns driver specific configuration options.

Parameters

string[] $database: An array of driver specific configuration options.

Return value

array The options form array.

Overrides Tasks::getFormOptions

File

core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php, line 45

Class

Tasks
Specifies installation tasks for SQLite databases.

Namespace

Drupal\sqlite\Driver\Database\sqlite\Install

Code

public function getFormOptions(array $database) {
  $form = parent::getFormOptions($database);

  // Remove the options that only apply to client/server style databases.
  unset($form['username'], $form['password'], $form['advanced_options']['host'], $form['advanced_options']['port']);

  // Make the text more accurate for SQLite.
  $form['database']['#title'] = t('Database file');
  $form['database']['#description'] = t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', [
    '@drupal' => drupal_install_profile_distribution_name(),
  ]);
  $default_database = \Drupal::getContainer()
    ->getParameter('site.path') . '/files/.ht.sqlite';
  $form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
  return $form;
}