function template_preprocess_webform_confirmation in Webform 7.4
Same name and namespace in other branches
- 8.5 includes/webform.theme.template.inc \template_preprocess_webform_confirmation()
- 6.3 webform.module \template_preprocess_webform_confirmation()
- 6.2 webform.module \template_preprocess_webform_confirmation()
- 7.3 webform.module \template_preprocess_webform_confirmation()
- 6.x includes/webform.theme.template.inc \template_preprocess_webform_confirmation()
Prepare for theming of the webform submission confirmation.
File
- ./
webform.module, line 3594 - This module provides a simple way to create forms and questionnaires.
Code
function template_preprocess_webform_confirmation(&$vars) {
$node = $vars['node'];
// Strip out empty tags added by WYSIWYG editors if needed.
$confirmation = $node->webform['confirmation'];
$confirmation = strlen(trim(strip_tags($confirmation))) ? $confirmation : '';
// Replace tokens.
module_load_include('inc', 'webform', 'includes/webform.submissions');
$submission = webform_get_submission($node->nid, $vars['sid']);
$vars['confirmation_message'] = webform_replace_tokens($confirmation, $node, $submission, NULL, $node->webform['confirmation_format']);
// URL back to form (or same page for in-block confirmations).
$vars['url'] = empty($node->webform_block) ? url('node/' . $node->nid) : url(current_path(), array(
'query' => drupal_get_query_parameters(),
));
// Progress bar.
$vars['progressbar'] = '';
if ($node->webform['progressbar_include_confirmation']) {
$page_labels = webform_page_labels($node);
$page_count = count($page_labels);
$vars['progressbar'] = theme('webform_progressbar', array(
'node' => $node,
'page_num' => $page_count,
'page_count' => $page_count,
'page_labels' => $page_labels,
));
}
}