O'Reilly logo

Drupal 7 Webform Cookbook by Douglas Vernon Denny

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a conditional action

As explained in the requirements specification at the start of the chapter, we only need our action to show up on the submission View and Edit pages if the current submission has a status of Accepted. We will utilize the hook_webform_submission_actions() hook exposed by Webform to add this programming logic.

How to do it...

Let us add the programming hook to our webform_custom_action.module file.

/** * Implements hook_webform_submission_actions(). */ function webform_custom_action_webform_submission_actions($node, $submission) { $actions = array(); // Does this submission already have Declined status? $declined = FALSE; if (isset($submission->data[19]['value'][0])) { if ($submission->data[19]['value'][0] == 'Declined') ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required