You are here

function hook_filetransfer_info in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/File/file.api.php \hook_filetransfer_info()
  2. 7 modules/system/system.api.php \hook_filetransfer_info()
  3. 9 core/lib/Drupal/Core/File/file.api.php \hook_filetransfer_info()

Register information about FileTransfer classes provided by a module.

The FileTransfer class allows transferring files over a specific type of connection. Core provides classes for FTP and SSH. Contributed modules are free to extend the FileTransfer base class to add other connection types, and if these classes are registered via hook_filetransfer_info(), those connection types will be available to site administrators using the Update manager when they are redirected to the authorize.php script to authorize the file operations.

Return value

array Nested array of information about FileTransfer classes. Each key is a FileTransfer type (not human readable, used for form elements and variable names, etc), and the values are subarrays that define properties of that type. The keys in each subarray are:

  • 'title': Required. The human-readable name of the connection type.
  • 'class': Required. The name of the FileTransfer class. The constructor will always be passed the full path to the root of the site that should be used to restrict where file transfer operations can occur (the $jail) and an array of settings values returned by the settings form.
  • 'weight': Optional. Integer weight used for sorting connection types on the authorize.php form.

See also

\Drupal\Core\FileTransfer\FileTransfer

authorize.php

hook_filetransfer_info_alter()

drupal_get_filetransfer_info()

Related topics

4 functions implement hook_filetransfer_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

drupal_get_filetransfer_info in core/includes/common.inc
Assembles the Drupal FileTransfer registry.
system_filetransfer_info in core/modules/system/system.module
Implements hook_filetransfer_info().
system_test_filetransfer_info in core/modules/system/tests/modules/system_test/system_test.module
Implements hook_filetransfer_info().
update_test_filetransfer_info in core/modules/update/tests/modules/update_test/update_test.module
Implements hook_filetransfer_info().
1 invocation of hook_filetransfer_info()
drupal_get_filetransfer_info in core/includes/common.inc
Assembles the Drupal FileTransfer registry.

File

core/lib/Drupal/Core/File/file.api.php, line 175
Hooks related to the File management system.

Code

function hook_filetransfer_info() {
  $info['sftp'] = [
    'title' => t('SFTP (Secure FTP)'),
    'class' => 'Drupal\\Core\\FileTransfer\\SFTP',
    'weight' => 10,
  ];
  return $info;
}