function FileTransferAuthorizeForm::getFiletransfer

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php \Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm::getFiletransfer()
  2. 10 core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php \Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm::getFiletransfer()
  3. 11.x core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php \Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm::getFiletransfer()

Gets a FileTransfer class for a specific transfer method and settings.

Parameters

$backend: The FileTransfer backend to get the class for.

$settings: Array of settings for the FileTransfer.

Return value

\Drupal\Core\FileTransfer\FileTransfer|bool An instantiated FileTransfer object for the requested method and settings, or FALSE if there was an error finding or instantiating it.

3 calls to FileTransferAuthorizeForm::getFiletransfer()
FileTransferAuthorizeForm::addConnectionSettings in core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
Generates the Form API array for a given connection backend's settings.
FileTransferAuthorizeForm::submitForm in core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
Form submission handler.
FileTransferAuthorizeForm::validateForm in core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
Form validation handler.

File

core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php, line 240

Class

FileTransferAuthorizeForm
Provides the file transfer authorization form.

Namespace

Drupal\Core\FileTransfer\Form

Code

protected function getFiletransfer($backend, $settings = []) {
    $filetransfer = FALSE;
    $info = $this->getRequest()
        ->getSession()
        ->get('authorize_filetransfer_info', []);
    if (!empty($info[$backend])) {
        if (class_exists($info[$backend]['class'])) {
            $filetransfer = $info[$backend]['class']::factory($this->root, $settings);
        }
    }
    return $filetransfer;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.