Révision 01f36513
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/webform/webform.api.php | ||
---|---|---|
246 | 246 |
* @param array $context |
247 | 247 |
* Array of context with indices 'nid' and 'uid'. |
248 | 248 |
*/ |
249 |
function hook_webform_draft_alter(&$sid, $context) { |
|
249 |
function hook_webform_draft_alter(&$sid, array $context) {
|
|
250 | 250 |
if ($_GET['newdraft']) { |
251 | 251 |
$sid = NULL; |
252 | 252 |
} |
... | ... | |
298 | 298 |
* automatically add data to the component based on the component form. Using |
299 | 299 |
* hook_form_alter() will be sufficient in most cases. |
300 | 300 |
* |
301 |
* @see hook_form_alter() |
|
302 |
* @see webform_component_edit_form() |
|
303 |
* |
|
304 | 301 |
* @param $component |
305 | 302 |
* The Webform component being saved. |
303 |
* |
|
304 |
* @see hook_form_alter() |
|
305 |
* @see webform_component_edit_form() |
|
306 | 306 |
*/ |
307 | 307 |
function hook_webform_component_presave(&$component) { |
308 | 308 |
$component['extra']['new_option'] = 'foo'; |
... | ... | |
362 | 362 |
* - components: The list of analyses for each analysis-enabled component |
363 | 363 |
* for the node. Each keyed by its component ID. |
364 | 364 |
*/ |
365 |
function hook_webform_analysis_alter(&$analysis) { |
|
365 |
function hook_webform_analysis_alter(array &$analysis) {
|
|
366 | 366 |
$node = $analysis['#node']; |
367 | 367 |
|
368 | 368 |
// Add an additional piece of information to every component's analysis: |
... | ... | |
395 | 395 |
* @see _webform_analysis_component() |
396 | 396 |
* @see hook_webform_analysis_alter() |
397 | 397 |
*/ |
398 |
function hook_webform_analysis_component_data_alter(&$data, $node, $component) {
|
|
398 |
function hook_webform_analysis_component_data_alter(array &$data, $node, array $component) {
|
|
399 | 399 |
if ($component['type'] === 'textfield') { |
400 | 400 |
// Do not display rows that contain a zero value. |
401 | 401 |
foreach ($data as $row_number => $row_data) { |
... | ... | |
532 | 532 |
// (like a fieldset or tabs). Defaults to FALSE. |
533 | 533 |
'group' => FALSE, |
534 | 534 |
|
535 |
// If this component can be used for SPAM analysis, usually with Mollom.
|
|
535 |
// If this component can be used for SPAM analysis. |
|
536 | 536 |
'spam_analysis' => FALSE, |
537 | 537 |
|
538 | 538 |
// If this component saves a file that can be used as an e-mail |
... | ... | |
626 | 626 |
case 'view': |
627 | 627 |
return TRUE; |
628 | 628 |
|
629 |
break; |
|
630 | 629 |
case 'edit': |
631 | 630 |
return FALSE; |
632 | 631 |
|
633 |
break; |
|
634 | 632 |
case 'delete': |
635 | 633 |
return TRUE; |
636 | 634 |
|
637 |
break; |
|
638 | 635 |
case 'list': |
639 | 636 |
return TRUE; |
640 |
|
|
641 |
break; |
|
642 | 637 |
} |
643 | 638 |
} |
644 | 639 |
|
... | ... | |
650 | 645 |
* Access via this hook is in addition (adds permission) to the standard |
651 | 646 |
* webform access. |
652 | 647 |
* |
653 |
* @see webform_results_access() |
|
654 |
* |
|
655 | 648 |
* @param $node |
656 | 649 |
* The Webform node to check access on. |
657 | 650 |
* @param $account |
... | ... | |
659 | 652 |
* |
660 | 653 |
* @return bool |
661 | 654 |
* TRUE or FALSE if the user can access the webform results. |
655 |
* |
|
656 |
* @see webform_results_access() |
|
662 | 657 |
*/ |
663 | 658 |
function hook_webform_results_access($node, $account) { |
664 | 659 |
// Let editors view results of unpublished webforms. |
... | ... | |
676 | 671 |
* Access via this hook is in addition (adds permission) to the standard |
677 | 672 |
* webform access (delete all webform submissions). |
678 | 673 |
* |
679 |
* @see webform_results_clear_access() |
|
680 |
* |
|
681 | 674 |
* @param object $node |
682 | 675 |
* The Webform node to check access on. |
683 | 676 |
* @param object $account |
... | ... | |
685 | 678 |
* |
686 | 679 |
* @return bool |
687 | 680 |
* TRUE or FALSE if the user can access the webform results. |
681 |
* |
|
682 |
* @see webform_results_clear_access() |
|
688 | 683 |
*/ |
689 | 684 |
function hook_webform_results_clear_access($node, $account) { |
690 | 685 |
return user_access('my additional access', $account); |
691 | 686 |
} |
692 | 687 |
|
693 | 688 |
/** |
689 |
* Overrides the node_access and user_access permissions. |
|
690 |
* |
|
694 | 691 |
* Overrides the node_access and user_access permission to access and edit |
695 | 692 |
* webform components, e-mails, conditions, and form settings. |
696 | 693 |
* |
... | ... | |
705 | 702 |
* access as this will be the only test. For example, 'return TRUE;' would grant |
706 | 703 |
* annonymous access to creating webform components, which seldom be desired. |
707 | 704 |
* |
708 |
* @see webform_node_update_access() |
|
709 |
* |
|
710 | 705 |
* @param object $node |
711 | 706 |
* The Webform node to check access on. |
712 | 707 |
* @param object $account |
... | ... | |
716 | 711 |
* TRUE or FALSE if the user can access the webform results, or NULL if |
717 | 712 |
* access should be deferred to other implementations of this hook or |
718 | 713 |
* node_access('update') plus user_access('edit webform components'). |
714 |
* |
|
715 |
* @see webform_node_update_access() |
|
719 | 716 |
*/ |
720 | 717 |
function hook_webform_update_access($node, $account) { |
721 | 718 |
// Allow anyone who can see webform_editable_by_user nodes and who has |
... | ... | |
766 | 763 |
* |
767 | 764 |
* @see webform_node_defaults() |
768 | 765 |
*/ |
769 |
function hook_webform_node_defaults_alter(&$defaults) { |
|
766 |
function hook_webform_node_defaults_alter(array &$defaults) {
|
|
770 | 767 |
$defaults['allow_draft'] = '1'; |
771 | 768 |
} |
772 | 769 |
|
... | ... | |
863 | 860 |
* every component type and are not necessary to specify here (although they |
864 | 861 |
* may be overridden if desired). |
865 | 862 |
* |
866 |
* @param $component |
|
863 |
* @param array $component
|
|
867 | 864 |
* A Webform component array. |
865 |
* @param array $form |
|
866 |
* The form array. |
|
867 |
* @param array $form_state |
|
868 |
* The form state array. |
|
868 | 869 |
* |
869 | 870 |
* @return array |
870 | 871 |
* An array of form items to be displayed on the edit component page |
871 | 872 |
*/ |
872 |
function _webform_edit_component($component) { |
|
873 |
$form = array(); |
|
874 |
|
|
873 |
function _webform_edit_component(array $component, array &$form, array &$form_state) { |
|
875 | 874 |
// Disabling the description if not wanted. |
876 |
$form['description'] = array();
|
|
875 |
$form['description']['#access'] = FALSE;
|
|
877 | 876 |
|
878 | 877 |
// Most options are stored in the "extra" array, which stores any settings |
879 | 878 |
// unique to a particular component type. |
... | ... | |
942 | 941 |
* |
943 | 942 |
* @see _webform_render_component() |
944 | 943 |
*/ |
945 |
function hook_webform_component_render_alter(&$element, &$component) {
|
|
944 |
function hook_webform_component_render_alter(array &$element, array &$component) {
|
|
946 | 945 |
if ($component['cid'] == 10) { |
947 | 946 |
$element['#title'] = 'My custom title'; |
948 | 947 |
$element['#default_value'] = 42; |
... | ... | |
1003 | 1002 |
* |
1004 | 1003 |
* @see _webform_display_component() |
1005 | 1004 |
*/ |
1006 |
function hook_webform_component_display_alter(&$element, &$component) {
|
|
1005 |
function hook_webform_component_display_alter(array &$element, array &$component) {
|
|
1007 | 1006 |
if ($component['cid'] == 10) { |
1008 | 1007 |
$element['#title'] = 'My custom title'; |
1009 | 1008 |
$element['#default_value'] = 42; |
... | ... | |
1026 | 1025 |
* @param string $value |
1027 | 1026 |
* The value to be set, as defined in the conditional action. |
1028 | 1027 |
*/ |
1029 |
function _webform_action_set_component($component, &$element, &$form_state, $value) {
|
|
1028 |
function _webform_action_set_component(array $component, array &$element, array &$form_state, $value) {
|
|
1030 | 1029 |
$element['#value'] = $value; |
1031 | 1030 |
form_set_value($element, $value, $form_state); |
1032 | 1031 |
} |
... | ... | |
1048 | 1047 |
* @param $value |
1049 | 1048 |
* The POST data associated with the user input. |
1050 | 1049 |
* |
1051 |
* @return |
|
1050 |
* @return array
|
|
1052 | 1051 |
* An array of values to be saved into the database. Note that this should be |
1053 | 1052 |
* a numerically keyed array. |
1054 | 1053 |
*/ |
... | ... | |
1312 | 1311 |
} |
1313 | 1312 |
|
1314 | 1313 |
/** |
1315 |
* Adjusts the view field(s) that are automatically generated for number |
|
1316 |
* components. |
|
1314 |
* Fix the view field(s) that are automatically generated for number components. |
|
1317 | 1315 |
* |
1318 | 1316 |
* Provides each component the opportunity to adjust how this component is |
1319 | 1317 |
* displayed in a view as a field in a view table. For example, a component may |
... | ... | |
1329 | 1327 |
* @return array |
1330 | 1328 |
* The modified $fields array. |
1331 | 1329 |
*/ |
1332 |
function _webform_view_field_component($component, $fields) {
|
|
1330 |
function _webform_view_field_component(array $component, array $fields) {
|
|
1333 | 1331 |
foreach ($fields as &$field) { |
1334 | 1332 |
$field['webform_datatype'] = 'number'; |
1335 | 1333 |
} |
... | ... | |
1356 | 1354 |
* @param array $args |
1357 | 1355 |
* The arguments that were passed to the view. |
1358 | 1356 |
*/ |
1359 |
function hook_webform_view_alter($view, $display_id, $args) { |
|
1357 |
function hook_webform_view_alter($view, $display_id, array $args) {
|
|
1360 | 1358 |
// Don't show component with cid == 4. |
1361 | 1359 |
$fields = $view->get_items('field', $display_id); |
1362 | 1360 |
foreach ($fields as $id => $field) { |
... | ... | |
1373 | 1371 |
* @param array &$systems |
1374 | 1372 |
* An array of mail system class names. |
1375 | 1373 |
*/ |
1376 |
function hook_webform_html_capable_mail_systems_alter(&$systems) { |
|
1374 |
function hook_webform_html_capable_mail_systems_alter(array &$systems) {
|
|
1377 | 1375 |
if (module_exists('my_module')) { |
1378 | 1376 |
$systems[] = 'MyModuleMailSystem'; |
1379 | 1377 |
} |
... | ... | |
1407 | 1405 |
* @param array &$exporters |
1408 | 1406 |
* A list of all available webform exporters. |
1409 | 1407 |
*/ |
1410 |
function hook_webform_exporters_alter(&$exporters) { |
|
1408 |
function hook_webform_exporters_alter(array &$exporters) {
|
|
1411 | 1409 |
$exporters['excel']['handler'] = 'customized_excel_exporter'; |
1412 | 1410 |
$exporters['excel']['file'] = drupal_get_path('module', 'yourmodule') . '/includes/customized_excel_exporter.inc'; |
1413 | 1411 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules