diff --git a/fillpdf.admin.inc b/fillpdf.admin.inc index 751e25ade205a2f91b0c658ec46f685613055a1d..abcea423d6362a4a5c047be12d7ba2373443e390 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 22d0b5f7a364fe5d21a671bef19e57cfedeeb595..f62eec6c1287db2cab46b3b3c5e905a1e60bf9d7 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