From 47d3032d0738ea01f3c9561fa9999aba097625f1 Mon Sep 17 00:00:00 2001 From: pancho <pancho@15425.no-reply.drupal.org> Date: Fri, 24 May 2019 14:55:42 -0400 Subject: [PATCH] Issue #3052949 by Pancho: Redirect sample links to PDF file --- fillpdf.admin.inc | 7 ++++++- fillpdf.module | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fillpdf.admin.inc b/fillpdf.admin.inc index 751e25a..abcea42 100644 --- a/fillpdf.admin.inc +++ b/fillpdf.admin.inc @@ -418,10 +418,15 @@ function fillpdf_form_edit($form, &$form_state, $fid) { '#description' => 'Update the PDF template used by this form', '#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( '#type' => 'item', '#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.'), ); if (!empty($pdf_form->default_nid)) { diff --git a/fillpdf.module b/fillpdf.module index 22d0b5f..f62eec6 100644 --- a/fillpdf.module +++ b/fillpdf.module @@ -569,8 +569,6 @@ function fillpdf_merge_pdf($fid, $nids = NULL, $webform_array = NULL, $sample = if ($sample) { // Fill template with the PDF field names to produce a sample PDF. $fields[$obj->pdf_key] = $obj->pdf_key; - // If sampling, return to the form edit page. - $_GET['destination'] = "admin/structure/fillpdf/$fid"; } else { // Multiple nids, #516840 we want the last nid in $_GET to override -- GitLab