function FileTransferAuthorizeForm::submitForm
Same name in other branches
- 8.9.x core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php \Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm::submitForm()
- 10 core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php \Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm::submitForm()
- 11.x core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php \Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm::submitForm()
Overrides FormInterface::submitForm
File
-
core/
lib/ Drupal/ Core/ FileTransfer/ Form/ FileTransferAuthorizeForm.php, line 189
Class
- FileTransferAuthorizeForm
- Provides the file transfer authorization form.
Namespace
Drupal\Core\FileTransfer\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$form_connection_settings = $form_state->getValue('connection_settings');
switch ($form_state->getTriggeringElement()['#name']) {
case 'process_updates':
// Save the connection settings to the DB.
$filetransfer_backend = $form_connection_settings['authorize_filetransfer_default'];
// If the database is available then try to save our settings. We have
// to make sure it is available since this code could potentially (will
// likely) be called during the installation process, before the
// database is set up.
try {
$filetransfer = $this->getFiletransfer($filetransfer_backend, $form_connection_settings[$filetransfer_backend]);
// Now run the operation.
$response = $this->runOperation($filetransfer);
if ($response instanceof Response) {
$form_state->setResponse($response);
}
} catch (\Exception $e) {
// If there is no database available, we don't care and just skip
// this part entirely.
}
break;
case 'enter_connection_settings':
$form_state->setRebuild();
break;
case 'change_connection_type':
$form_state->setRebuild();
$form_state->unsetValue([
'connection_settings',
'authorize_filetransfer_default',
]);
break;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.