Skip to content

Instantly share code, notes, and snippets.

@lifedraft
Created November 7, 2013 08:36
Show Gist options
  • Save lifedraft/7351155 to your computer and use it in GitHub Desktop.
Save lifedraft/7351155 to your computer and use it in GitHub Desktop.
Using drupal's webform_token module to replace values of confirmation message. e.q: Congratulations, [webform:val-salutation]. [webform:val-last_name]
function hook_preprocess_webform_confirmation(&$vars) {
module_load_include('inc', 'webform', 'includes/webform.submissions');
$node = $vars['node'];
$webform = $node->webform;
$submission = webform_get_submission($node->nid, $vars["sid"]);
$confirmation = $node->webform['confirmation'];
$confirmation = token_replace($confirmation, array('webform' => $submission), array('webform_tokens'));
$vars['confirmation_message'] = $confirmation;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment