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