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.
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') { $declined = TRUE; } } // Show action if user has results access and submission not already declined. if (webform_results_access($node) && !$declined) { $actions['declined'] = array( 'title' => t('Decline speaker'), 'href' =...