public function FileTransfer::getSettingsForm

Returns a form to collect connection settings credentials.

Implementing classes can either extend this form with fields collecting the specific information they need, or override it entirely.

Return value

array An array that contains a Form API definition.

2 calls to FileTransfer::getSettingsForm()
FTP::getSettingsForm in drupal/core/lib/Drupal/Core/FileTransfer/FTP.php
Overrides Drupal\Core\FileTransfer\FileTransfer::getSettingsForm().
SSH::getSettingsForm in drupal/core/lib/Drupal/Core/FileTransfer/SSH.php
Overrides Drupal\Core\FileTransfer\FileTransfer::getSettingsForm().
2 methods override FileTransfer::getSettingsForm()
FTP::getSettingsForm in drupal/core/lib/Drupal/Core/FileTransfer/FTP.php
Overrides Drupal\Core\FileTransfer\FileTransfer::getSettingsForm().
SSH::getSettingsForm in drupal/core/lib/Drupal/Core/FileTransfer/SSH.php
Overrides Drupal\Core\FileTransfer\FileTransfer::getSettingsForm().

File

drupal/core/lib/Drupal/Core/FileTransfer/FileTransfer.php, line 398
Definition of Drupal\Core\FileTransfer\FileTransfer.

Class

FileTransfer
Defines the base FileTransfer class.

Namespace

Drupal\Core\FileTransfer

Code

public function getSettingsForm() {
  $form['username'] = array(
    '#type' => 'textfield',
    '#title' => t('Username'),
  );
  $form['password'] = array(
    '#type' => 'password',
    '#title' => t('Password'),
    '#description' => t('Your password is not saved in the database and is only used to establish a connection.'),
  );
  $form['advanced'] = array(
    '#type' => 'details',
    '#title' => t('Advanced settings'),
    '#collapsed' => TRUE,
  );
  $form['advanced']['hostname'] = array(
    '#type' => 'textfield',
    '#title' => t('Host'),
    '#default_value' => 'localhost',
    '#description' => t('The connection will be created between your web server and the machine hosting the web server files. In the vast majority of cases, this will be the same machine, and "localhost" is correct.'),
  );
  $form['advanced']['port'] = array(
    '#type' => 'textfield',
    '#title' => t('Port'),
    '#default_value' => NULL,
  );
  return $form;
}