You are here

function drupal_get_filetransfer_info in Drupal 7

Same name and namespace in other branches
  1. 8 core/includes/common.inc \drupal_get_filetransfer_info()
  2. 9 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 8573
Common functions that many Drupal modules will need to reference.

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;
}