Révision 8c72e82a
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/modules/webform/webform.api.php | ||
---|---|---|
24 | 24 |
* @see webform_options_example() |
25 | 25 |
* @see hook_webform_select_options_info_alter() |
26 | 26 |
* |
27 |
* @return |
|
27 |
* @return array
|
|
28 | 28 |
* An array of callbacks that can be used for select list options. This array |
29 | 29 |
* should be keyed by the "name" of the pre-defined list. The values should |
30 | 30 |
* be an array with the following additional keys: |
31 | 31 |
* - title: The translated title for this list. |
32 |
* - options callback: The name of the function that will return the list. |
|
32 |
* - options callback: The name of a function implementing |
|
33 |
* callback_webform_options() that will return the list. |
|
33 | 34 |
* - options arguments: Any additional arguments to send to the callback. |
34 | 35 |
* - file: Optional. The file containing the options callback, relative to |
35 | 36 |
* the module root. |
... | ... | |
49 | 50 |
/** |
50 | 51 |
* Alter the list of select list options provided by Webform and other modules. |
51 | 52 |
* |
52 |
* @see hook_webform_select_options_info().
|
|
53 |
* @see hook_webform_select_options_info() |
|
53 | 54 |
*/ |
54 | 55 |
function hook_webform_select_options_info_alter(&$items) { |
55 | 56 |
// Remove the days of the week options. |
... | ... | |
57 | 58 |
} |
58 | 59 |
|
59 | 60 |
/** |
60 |
* This is an example function to demonstrate a webform options callback.
|
|
61 |
* Define a list of options that Webform may use in a select component.
|
|
61 | 62 |
* |
62 |
* This function returns a list of options that Webform may use in a select |
|
63 |
* component. In order to be called, the function name |
|
64 |
* ("webform_options_example" in this case), needs to be specified as a callback |
|
65 |
* in hook_webform_select_options_info(). |
|
63 |
* Callback for hook_webform_select_options_info(). |
|
66 | 64 |
* |
67 | 65 |
* @param $component |
68 | 66 |
* The Webform component array for the select component being displayed. |
... | ... | |
73 | 71 |
* without the nesting. |
74 | 72 |
* @param $arguments |
75 | 73 |
* The "options arguments" specified in hook_webform_select_options_info(). |
76 |
* @return |
|
74 |
* |
|
75 |
* @return array |
|
77 | 76 |
* An array of key => value pairs suitable for a select list's #options |
78 | 77 |
* FormAPI property. |
79 | 78 |
*/ |
80 |
function webform_options_example($component, $flat, $arguments) {
|
|
79 |
function callback_webform_options($component, $flat, $arguments) {
|
|
81 | 80 |
$options = array( |
82 | 81 |
'one' => t('Pre-built option one'), |
83 | 82 |
'two' => t('Pre-built option two'), |
... | ... | |
214 | 213 |
* The Webform node on which this submission was made. |
215 | 214 |
* @param $submission |
216 | 215 |
* The Webform submission on which the actions may be performed. |
216 |
* |
|
217 |
* @return array |
|
218 |
* List of action. |
|
217 | 219 |
*/ |
218 | 220 |
function hook_webform_submission_actions($node, $submission) { |
219 | 221 |
$actions= array(); |
... | ... | |
428 | 430 |
/** |
429 | 431 |
* Define components to Webform. |
430 | 432 |
* |
431 |
* @return |
|
433 |
* @return array
|
|
432 | 434 |
* An array of components, keyed by machine name. Required properties are |
433 | 435 |
* "label" and "description". The "features" array defines which capabilities |
434 | 436 |
* the component has, such as being displayed in e-mails or csv downloads. |
... | ... | |
613 | 615 |
* - "list" |
614 | 616 |
* @param $account |
615 | 617 |
* A user account object. |
616 |
* @return |
|
618 |
* |
|
619 |
* @return bool |
|
617 | 620 |
* TRUE if the current user has access to submission, |
618 | 621 |
* or FALSE otherwise. |
619 | 622 |
*/ |
... | ... | |
642 | 645 |
* Access via this hook is in addition (adds permission) to the standard |
643 | 646 |
* webform access. |
644 | 647 |
* |
645 |
* @see webform_results_access().
|
|
648 |
* @see webform_results_access() |
|
646 | 649 |
* |
647 | 650 |
* @param $node |
648 | 651 |
* The Webform node to check access on. |
649 | 652 |
* @param $account |
650 | 653 |
* The user account to check access on. |
651 |
* @return |
|
654 |
* |
|
655 |
* @return bool |
|
652 | 656 |
* TRUE or FALSE if the user can access the webform results. |
653 | 657 |
*/ |
654 | 658 |
function hook_webform_results_access($node, $account) { |
... | ... | |
667 | 671 |
* Access via this hook is in addition (adds permission) to the standard |
668 | 672 |
* webform access (delete all webform submissions). |
669 | 673 |
* |
670 |
* @see webform_results_clear_access().
|
|
674 |
* @see webform_results_clear_access() |
|
671 | 675 |
* |
672 | 676 |
* @param object $node |
673 | 677 |
* The Webform node to check access on. |
... | ... | |
695 | 699 |
* access as this will be the only test. For example, 'return TRUE;' would grant |
696 | 700 |
* annonymous access to creating webform components, which seldom be desired. |
697 | 701 |
* |
698 |
* @see webform_node_update_access().
|
|
702 |
* @see webform_node_update_access() |
|
699 | 703 |
* |
700 | 704 |
* @param object $node |
701 | 705 |
* The Webform node to check access on. |
... | ... | |
715 | 719 |
} |
716 | 720 |
} |
717 | 721 |
|
718 |
|
|
719 | 722 |
/** |
720 | 723 |
* Return an array of files associated with the component. |
721 | 724 |
* |
... | ... | |
726 | 729 |
* @param $value |
727 | 730 |
* An array of information containing the submission result, directly |
728 | 731 |
* correlating to the webform_submitted_data database schema. |
729 |
* @return |
|
732 |
* |
|
733 |
* @return array |
|
730 | 734 |
* An array of files, each file is an array with following keys: |
731 | 735 |
* - filepath: The relative path to the file. |
732 | 736 |
* - filename: The name of the file including the extension. |
... | ... | |
746 | 750 |
return $files; |
747 | 751 |
} |
748 | 752 |
|
749 |
|
|
750 | 753 |
/** |
751 | 754 |
* Alter default settings for a newly created webform node. |
752 | 755 |
* |
... | ... | |
762 | 765 |
/** |
763 | 766 |
* Add additional fields to submission data downloads. |
764 | 767 |
* |
765 |
* @return |
|
768 |
* @return array
|
|
766 | 769 |
* Keys and titles for default submission information. |
767 | 770 |
* |
768 | 771 |
* @see hook_webform_results_download_submission_information_data() |
... | ... | |
781 | 784 |
* The name of the token being replaced. |
782 | 785 |
* @param $submission |
783 | 786 |
* The data for an individual submission from webform_get_submissions(). |
784 |
* @param $options |
|
787 |
* @param array $options
|
|
785 | 788 |
* A list of options that define the output format. These are generally passed |
786 | 789 |
* through from the GUI interface. |
787 | 790 |
* @param $serial_start |
... | ... | |
789 | 792 |
* @param $row_count |
790 | 793 |
* The number of the row being generated. |
791 | 794 |
* |
792 |
* @return |
|
795 |
* @return string
|
|
793 | 796 |
* Value for requested submission information field. |
794 | 797 |
* |
795 | 798 |
* @see hook_webform_results_download_submission_information_info() |
... | ... | |
819 | 822 |
/** |
820 | 823 |
* Specify the default properties of a component. |
821 | 824 |
* |
822 |
* @return |
|
825 |
* @return array
|
|
823 | 826 |
* An array defining the default structure of a component. |
824 | 827 |
*/ |
825 | 828 |
function _webform_defaults_component() { |
... | ... | |
853 | 856 |
* |
854 | 857 |
* @param $component |
855 | 858 |
* A Webform component array. |
856 |
* @return |
|
859 |
* |
|
860 |
* @return array |
|
857 | 861 |
* An array of form items to be displayed on the edit component page |
858 | 862 |
*/ |
859 | 863 |
function _webform_edit_component($component) { |
... | ... | |
896 | 900 |
* needed. Used by _webform_render_date() to validate using the submission's |
897 | 901 |
* completion date. |
898 | 902 |
* |
903 |
* @return array |
|
904 |
* $form_item |
|
905 |
* |
|
899 | 906 |
* @see _webform_client_form_add_component() |
900 | 907 |
*/ |
901 | 908 |
function _webform_render_component($component, $value = NULL, $filter = TRUE, $submission = NULL) { |
... | ... | |
950 | 957 |
* or other filtering functions when returning HTML. |
951 | 958 |
* @param $submission |
952 | 959 |
* The submission. Used to generate tokens. |
953 |
* @return |
|
960 |
* |
|
961 |
* @return array |
|
954 | 962 |
* A renderable element containing at the very least these properties: |
955 | 963 |
* - #title |
956 | 964 |
* - #weight |
... | ... | |
1120 | 1128 |
* @param $join |
1121 | 1129 |
* An optional SelectQuery object to be used to join with the submissions |
1122 | 1130 |
* table to restrict the submissions being analyzed. |
1123 |
* @return |
|
1131 |
* |
|
1132 |
* @return array |
|
1124 | 1133 |
* An array containing one or more of the following keys: |
1125 | 1134 |
* - table_rows: If this component has numeric data that can be represented in |
1126 | 1135 |
* a grid, return the values here. This array assumes a 2-dimensional |
... | ... | |
1208 | 1217 |
* @param $value |
1209 | 1218 |
* An array of information containing the submission result, directly |
1210 | 1219 |
* correlating to the webform_submitted_data database schema. |
1211 |
* @return |
|
1220 |
* |
|
1221 |
* @return string |
|
1212 | 1222 |
* Textual output formatted for human reading. |
1213 | 1223 |
*/ |
1214 | 1224 |
function _webform_table_component($component, $value) { |
... | ... | |
1238 | 1248 |
* A Webform component array. |
1239 | 1249 |
* @param $export_options |
1240 | 1250 |
* An array of options that may configure export of this field. |
1241 |
* @return |
|
1251 |
* |
|
1252 |
* @return array |
|
1242 | 1253 |
* An array of data to be displayed in the first three rows of a CSV file, not |
1243 | 1254 |
* including either prefixed or trailing commas. |
1244 | 1255 |
*/ |
... | ... | |
1275 | 1286 |
* @param $value |
1276 | 1287 |
* An array of information containing the submission result, directly |
1277 | 1288 |
* correlating to the webform_submitted_data database schema. |
1278 |
* @return |
|
1289 |
* |
|
1290 |
* @return array |
|
1279 | 1291 |
* An array of items to be added to the CSV file. Each value within the array |
1280 | 1292 |
* will be another column within the file. This function is called once for |
1281 | 1293 |
* every row of data. |
Formats disponibles : Unified diff
Weekly update of contrib modules