README.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. This module provides a basic rules integration for webform.
  2. -- REQUIREMENTS --
  3. You need the following modules for a working feature:
  4. * Webform (http://drupal.org/project/webform)
  5. * Rules (http://drupal.org/project/rules)
  6. optional:
  7. * Token (http://drupal.org/project/token)
  8. -- INSTALLATION --
  9. Copy the module files to you module directory and then enable it on the admin
  10. modules page. After that you'll see a new event in the listing while creating
  11. a new rule.
  12. -- USAGE --
  13. Using the submitted data in a rule is easy, as you can access it either via PHP
  14. or using tokens (after installing the Token-module).
  15. PHP:
  16. Each rule reacting on an event thrown by "Webform Rules" gets 3 arguments to
  17. work with:
  18. * $user
  19. The user object of the acting user (the one, who submitted the webform).
  20. * $node
  21. The webform itself.
  22. * $data
  23. The submitted webform data and the submission id.
  24. To get the submission id, use <code><?php print $data['sid']; ?></code>.
  25. The components of the webform are stored using this structure:
  26. <code>array(
  27. '{form_key}' => array(
  28. 'value' => {submitted value},
  29. 'component' => {webform component},
  30. ),
  31. )</code>
  32. Given this structure, you can access the value of a component called
  33. "email" with
  34. <code><?php print $data['components']['email']['value'][0]; ?></code>.
  35. Warning:
  36. This is raw user input! Make sure to run this through check_plain() before
  37. using it.
  38. Note:
  39. The component value is always an array since the submission data is saved
  40. this way.
  41. Token:
  42. There are 9 pre-defined tokens for the webform data:
  43. * [data:sid]
  44. Token to get the unique identifier of the submission.
  45. * [data:data]
  46. This one prints out all data submitted by the webform in the following
  47. format:
  48. {form_key}: {label}: {value}
  49. * [data:data-raw]
  50. This one does exactly the same as [data:data] with the difference to not
  51. clean up the values using check_plain().
  52. * [data:{component}-title]
  53. This is a dynamic token. "{component}" is a placeholder for the components
  54. form key (machine readable name). Example: your webform has a component with
  55. the form key "email". So you would write [data:email-title] to use the title
  56. (label) of this field.
  57. * [data:{component}-value]
  58. Same as [data:{component}-title], but it returns the value instead of the
  59. title.
  60. * [data:{component}-value-html]
  61. This one does exactly the same as [data:{component}-value] with the
  62. difference that its output will be rendered as html.
  63. * [data:{component}-value-raw]
  64. This one does exactly the same as [data:{component}-value] with the
  65. difference to not clean up the value using check_plain(). This is raw user
  66. input so take care if you use this somewhere else.
  67. * [data:{component}-display]
  68. Returns a combination of [data:{component}-title] and
  69. [data:{component}-value] (done by module Webform).
  70. * [data:{component}-display-html]
  71. This one does exactly the same as [data:{component}-display] with the
  72. difference that its output will be rendered as html.
  73. Condition:
  74. Webform Rules adds a new condition to the rules configuration. With this
  75. condition you can tell rules to react only on one specific webform by selecting
  76. its title.
  77. -- AUTHOR --
  78. Stefan Borchert
  79. http://drupal.org/user/36942
  80. http://www.undpaul.de