Further modules included.
[yaffs-website] / web / modules / contrib / filefield_sources / filefield_sources.api.php
1 <?php
2 /**
3  * @file
4  * This file documents hooks provided by the FileField Sources module.
5  *
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
8  * in your own module.
9  */
10
11 /**
12  * Returns a list of widgets that are compatible with FileField Sources.
13  *
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.
18  */
19 function hook_filefield_sources_widgets() {
20   // Add any widgets that your module supports here.
21   return array('mymodule_file_widgetname');
22 }
23
24 /**
25  * Allows altering the sources available on a field.
26  *
27  * This hook allows other modules to modify the sources available to a user.
28  *
29  * @param array $sources
30  *   List of filefiled sources plugins.
31  *
32  * @param mixed $context
33  *   Contains 'enabled_sources', 'element', 'form_state'.
34  */
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]);
40     }
41   }
42 }