4 * This file documents hooks provided by the FileField Sources module.
6 * Note that none of this code is executed by using FileField Sources module,
7 * it is provided here for reference as an example how to implement these hooks
12 * Returns a list of widgets that are compatible with FileField Sources.
14 * FileField Sources works with the most common widgets used with Drupal (the
15 * standard Image and File widgets). Any module that provides another widget
16 * for uploading files may add compatibility with FileField Sources by
17 * implementing this hook and returning the widgets that their module supports.
19 function hook_filefield_sources_widgets() {
20 // Add any widgets that your module supports here.
21 return array('mymodule_file_widgetname');
25 * Allows altering the sources available on a field.
27 * This hook allows other modules to modify the sources available to a user.
29 * @param array $sources
30 * List of filefiled sources plugins.
32 * @param mixed $context
33 * Contains 'enabled_sources', 'element', 'form_state'.
35 function hook_filefield_sources_sources_alter(&$sources, $context) {
36 // This example will exclude sources the user doesn't have access to.
37 foreach (array_keys($sources) as $type) {
38 if (!user_access("use $type filefield source")) {
39 unset($sources[$type]);