function drupal_get_filetransfer_info

Same name in other branches
  1. 9 core/includes/common.inc \drupal_get_filetransfer_info()
  2. 8.9.x core/includes/common.inc \drupal_get_filetransfer_info()
  3. 10 core/includes/common.inc \drupal_get_filetransfer_info()
  4. 11.x core/includes/common.inc \drupal_get_filetransfer_info()

Assembles the Drupal FileTransfer registry.

Return value

The Drupal FileTransfer class registry.

See also

FileTransfer

hook_filetransfer_info()

hook_filetransfer_info_alter()

2 calls to drupal_get_filetransfer_info()
system_authorized_init in modules/system/system.module
Setup a given callback to run via authorize.php with elevated privileges.
_update_manager_check_backends in modules/update/update.manager.inc
Checks for file transfer backends and prepares a form fragment about them.

File

includes/common.inc, line 8629

Code

function drupal_get_filetransfer_info() {
    $info =& drupal_static(__FUNCTION__);
    if (!isset($info)) {
        // Since we have to manually set the 'file path' default for each
        // module separately, we can't use module_invoke_all().
        $info = array();
        foreach (module_implements('filetransfer_info') as $module) {
            $function = $module . '_filetransfer_info';
            if (function_exists($function)) {
                $result = $function();
                if (isset($result) && is_array($result)) {
                    foreach ($result as &$values) {
                        if (empty($values['file path'])) {
                            $values['file path'] = drupal_get_path('module', $module);
                        }
                    }
                    $info = array_merge_recursive($info, $result);
                }
            }
        }
        drupal_alter('filetransfer_info', $info);
        uasort($info, 'drupal_sort_weight');
    }
    return $info;
}

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