/**
* {@inheritdoc}
*/
public function buildForm(array
$form, FormStateInterface
$form_state) { // Get all the available ways to transfer files.
$available_backends =
$this->
getRequest()->
getSession()->
get('authorize_filetransfer_info',
[]);
if (empty($available_backends)) { $this->
messenger()->
addError($this->
t('Unable to continue, no available methods of file transfer'
));
return [];
} if (!
$this->
getRequest()->
isSecure()) { $form['information'
]['https_warning'
] =
[ '#prefix' => '<div class="messages messages--error">',
'#markup' =>
$this->
t('WARNING: You are not using an encrypted connection, so your password will be sent in plain text. <a href=":https-link">Learn more</a>.',
[':https-link' => 'https://www.drupal.org/https-information'
]),
'#suffix' => '</div>',
];
} // Decide on a default backend.
$authorize_filetransfer_default =
$form_state->
getValue(['connection_settings', 'authorize_filetransfer_default'
]);
if (!
$authorize_filetransfer_default) { $authorize_filetransfer_default =
key($available_backends);
}