Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webform_rules
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
webform_rules
Commits
3005c26b
Commit
3005c26b
authored
11 years ago
by
Stefan Borchert
Browse files
Options
Downloads
Patches
Plain Diff
Issue #1940282: add action to fetch webform submissions.
Signed-off-by:
Stefan Borchert
<
stefan.borchert@undpaul.de
>
parent
4fe5c183
Branches
master
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.txt
+4
-0
4 additions, 0 deletions
README.txt
webform_rules.rules.inc
+52
-1
52 additions, 1 deletion
webform_rules.rules.inc
with
56 additions
and
1 deletion
README.txt
+
4
−
0
View file @
3005c26b
...
...
@@ -93,6 +93,10 @@ Condition:
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 --
...
...
This diff is collapsed.
Click to expand it.
webform_rules.rules.inc
+
52
−
1
View file @
3005c26b
...
...
@@ -104,7 +104,7 @@ function webform_rules_rules_action_info() {
'type'
=>
'list<text>'
,
'label'
=>
t
(
'Webforms'
),
'options list'
=>
'webform_rules_get_webforms_as_options'
,
'description'
=>
t
(
'
The name of the
webforms to open.'
),
'description'
=>
t
(
'
List of
webforms to open.'
),
'restriction'
=>
'input'
,
'optional'
=>
TRUE
,
),
...
...
@@ -122,6 +122,31 @@ function webform_rules_rules_action_info() {
'label'
=>
t
(
'Close webforms'
),
'base'
=>
'webform_rules_webform_close'
,
),
'webform_submissions_load'
=>
array
(
'label'
=>
t
(
'Fetch webform submissions'
),
'base'
=>
t
(
'webform_rules_submissions_load'
),
'group'
=>
t
(
'Webform'
),
'access callback'
=>
'rules_node_admin_access'
,
'parameter'
=>
array
(
'nid'
=>
array
(
'type'
=>
'integer'
,
'label'
=>
t
(
'Node ID'
),
'description'
=>
t
(
'The ID of the webform node to load the submission for.'
),
),
'sid'
=>
array
(
'type'
=>
'integer'
,
'label'
=>
t
(
'Submission ID'
),
'description'
=>
t
(
'The ID of a webform submission. If omitted all submissions of the specified node ID will be fetched.'
),
'optional'
=>
TRUE
,
),
),
'provides'
=>
array
(
'submissions'
=>
array
(
'label'
=>
t
(
'Fetched submissions'
),
'type'
=>
'list<list>'
,
),
),
),
);
// Modify description of closing action.
...
...
@@ -226,6 +251,32 @@ function _webform_rules_webform_set_status($entity = FALSE, $selected_webforms =
}
}
/**
* Rules action to load a list of webform submissions.
*
* @param int $nid
* ID of node to load the submissions for.
* @param int $sid
* (optional) Submission ID.
*
* @return array
* List of loaded webform submissions.
*/
function
webform_rules_submissions_load
(
$nid
,
$sid
=
NULL
)
{
// Make sure the needed functions are available.
module_load_include
(
'inc'
,
'webform'
,
'includes/webform.submissions'
);
$filters
=
array
(
'nid'
=>
$nid
,
);
if
(
!
empty
(
$sid
))
{
$filters
[
'sid'
]
=
$sid
;
}
// Fetch submissions.
$submissions
=
webform_get_submissions
(
$filters
);
return
array
(
'submissions'
=>
$submissions
);
}
/**
* Helper function for event variables.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment