Skip to content
Snippets Groups Projects
Commit 00c3661d authored by Kevin Kaland's avatar Kevin Kaland
Browse files

Issue #1612270: Support Webform 4.x tokens.

Conflicts:
	fillpdf.admin.inc
parent 0cea26fe
No related branches found
No related tags found
No related merge requests found
......@@ -272,6 +272,7 @@ function fillpdf_form_edit($form, &$form_state, $fid) {
);
$form['title_tokens_fieldset']['tokens'] = _fillpdf_admin_token_form();
$form['default_nid'] = array(
'#type' => 'textfield',
'#title' => t('Default Node ID'),
......@@ -723,10 +724,7 @@ function fillpdf_field_edit($form, &$form_state, $pdf_form, $field) {
'#collapsed' => FALSE,
'#weight' => 5,
);
$form['tokens_fieldset']['tokens'] = array(
'#theme' => 'token_tree',
'#token_types' => array('node', 'webform'),
);
$form['tokens_fieldset']['tokens'] = _fillpdf_admin_token_form();
$form['suffix'] = array(
'#type' => 'textarea',
'#title' => t('Suffix'),
......@@ -814,7 +812,8 @@ function fillpdf_update_field(&$pdf_form, &$field, $old_key) {
function _fillpdf_admin_token_form() {
return array(
'#theme' => 'token_tree',
'#token_types' => array('node', 'webform'),
'#token_types' => array('node', 'webform-tokens', 'submission'),
'#global_types' => FALSE,
);
}
......@@ -376,8 +376,11 @@ function fillpdf_merge_pdf($fid, $nids = NULL, $webform_arr = NULL, $sample = NU
// --- webform token replacements
if (!empty($webforms)) {
foreach ($webforms as $webform) {
$token_objects['webform'] = $webform['submission'];
$token = token_replace($obj->value, array('webform' => $webform['submission']), array('clear' => TRUE));
$token_objects += array(
'webform-submission' => $webform['submission'],
);
$token = token_replace($obj->value, $token_objects, array('clear' => TRUE));
if ($token) {
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment