You are here

function hook_filefield_sources_info in FileField Sources 7

Same name and namespace in other branches
  1. 6 filefield_sources.api.php \hook_filefield_sources_info()

Return a list of available sources that FileField Sources can use.

This hook returns a list of possible sources that can be utilized. Each source must be enabled by the end user before it can be used on a file field. Note that the ability to provide a configuration for this source is not directly provided by FileField Sources, instead you may implement the form_alter() hooks provided by Drupal core to add your options to the existing list of FileField Source options.

1 function implements hook_filefield_sources_info()

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

filefield_sources_filefield_sources_info in ./filefield_sources.module
Implements hook_filefield_sources_info().
1 invocation of hook_filefield_sources_info()
filefield_sources_info in ./filefield_sources.module
Load hook_filefield_sources_info() data from all modules.

File

./filefield_sources.api.php, line 33
This file documents hooks provided by the FileField Sources module. Note that none of this code is executed by using FileField Sources module, it is provided here for reference as an example how to implement these hooks in your own module.

Code

function hook_filefield_sources_info() {
  $sources = array();

  // Provide a potential Flickr source to import Flickr photos.
  $sources['flickr'] = array(
    'name' => t('File attach from Flickr'),
    'label' => t('Flickr'),
    'description' => t('Select a file from Flickr.'),
    // This callback function does all the heavy-work of creating a form element
    // to choose a Flickr photo and populate a field. For an example, see
    // filefield_source_remote_process().
    'process' => 'mymodule_filefield_source_flickr_process',
    // This callback function then takes the value of that field and saves the
    // file locally. For an example, see filefield_source_remote_value().
    'value' => 'mymodule_filefield_source_flickr_value',
    'weight' => 3,
    // This optional setting will ensure that your code is included when needed
    // if your value, process, or other callbacks are located in a file other
    // than your .module file.
    'file' => 'include/mymodule.flickr_source.inc',
  );
  return $sources;
}