function fillpdf_form_edit_submit in FillPDF 7.2
Same name and namespace in other branches
- 5 fillpdf.module \fillpdf_form_edit_submit()
- 6 fillpdf.admin.inc \fillpdf_form_edit_submit()
- 7 fillpdf.admin.inc \fillpdf_form_edit_submit()
Submit Edit or Delete for existing PDF form
File
- ./
fillpdf.admin.inc, line 367 - Allows mappings of PDFs to site content
Code
function fillpdf_form_edit_submit($form, &$form_state) {
if ($form_state['values']['op'] == t('Delete')) {
$form_state['redirect'] = "admin/structure/fillpdf/{$form['#pdf_form']->fid}/delete";
return;
}
else {
db_update('fillpdf_forms')
->fields(array(
'title' => $form_state['values']['title'],
'default_nid' => (int) $form_state['values']['default_nid'] > 0 ? (int) $form_state['values']['default_nid'] : NULL,
'destination_path' => $form_state['values']['destination_path'],
'replacements' => $form_state['values']['replacements'],
'destination_redirect' => $form_state['values']['destination_redirect'],
'admin_title' => $form_state['values']['admin_title'],
))
->condition('fid', $form['#pdf_form']->fid)
->execute();
if ($file = $_FILES['files']['name']['upload_pdf']) {
// Export the current field mappings to a variable
$mappings = fillpdf_generate_mappings($form['#pdf_form'], TRUE);
// Save the uploaded file; this also re-parses it
_fillpdf_save_upload('upload_pdf', $form['#pdf_form']->fid);
// Import the ones we just saved. This ensures there are
// orphaned mappings.
drupal_set_message(t('Your previous field mappings have been transferred to the new PDF template you uploaded. Review the messages below to make sure the results are what you expected.'));
fillpdf_import_mappings($form['#pdf_form'], $mappings);
}
$form_state['redirect'] = "admin/structure/fillpdf/{$form['#pdf_form']->fid}";
drupal_set_message(t('Successfully updated form.'));
}
}