Skip to content
Snippets Groups Projects
Commit 47d3032d authored by pancho's avatar pancho Committed by Liam Morland
Browse files

Issue #3052949 by Pancho: Redirect sample links to PDF file

parent 4048fc18
No related branches found
No related tags found
No related merge requests found
...@@ -418,10 +418,15 @@ function fillpdf_form_edit($form, &$form_state, $fid) { ...@@ -418,10 +418,15 @@ function fillpdf_form_edit($form, &$form_state, $fid) {
'#description' => 'Update the PDF template used by this form', '#description' => 'Update the PDF template used by this form',
'#attributes' => array('accept' => 'application/pdf'), '#attributes' => array('accept' => 'application/pdf'),
); );
$url = fillpdf_pdf_link($fid, NULL, NULL, TRUE);
// Unless we're redirecting to the PDF file, return to the form edit page.
if (!empty($pdf_form->destination_path) && !$pdf_form->destination_redirect) {
$url .= '&destination=admin/structure/fillpdf/' . $fid;
}
$form['pdf_info']['sample_populate'] = array( $form['pdf_info']['sample_populate'] = array(
'#type' => 'item', '#type' => 'item',
'#title' => 'Sample PDF', '#title' => 'Sample PDF',
'#description' => l(t('See which fields are which in this PDF.'), fillpdf_pdf_link($fid, NULL, NULL, TRUE)) . '<br />' . '#description' => l(t('See which fields are which in this PDF.'), $url) . '<br />' .
t('If you have set a custom path on this PDF, the sample will be saved there silently.'), t('If you have set a custom path on this PDF, the sample will be saved there silently.'),
); );
if (!empty($pdf_form->default_nid)) { if (!empty($pdf_form->default_nid)) {
......
...@@ -569,8 +569,6 @@ function fillpdf_merge_pdf($fid, $nids = NULL, $webform_array = NULL, $sample = ...@@ -569,8 +569,6 @@ function fillpdf_merge_pdf($fid, $nids = NULL, $webform_array = NULL, $sample =
if ($sample) { if ($sample) {
// Fill template with the PDF field names to produce a sample PDF. // Fill template with the PDF field names to produce a sample PDF.
$fields[$obj->pdf_key] = $obj->pdf_key; $fields[$obj->pdf_key] = $obj->pdf_key;
// If sampling, return to the form edit page.
$_GET['destination'] = "admin/structure/fillpdf/$fid";
} }
else { else {
// Multiple nids, #516840 we want the last nid in $_GET to override // Multiple nids, #516840 we want the last nid in $_GET to override
......
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