function fillpdf_import_mappings in FillPDF 7
Same name and namespace in other branches
- 7.2 fillpdf.admin.inc \fillpdf_import_mappings()
Import an array of decoded FillPDF mappings.
For the format, see fillpdf_generate_mappings().
2 calls to fillpdf_import_mappings()
- fillpdf_form_edit_submit in ./
fillpdf.admin.inc - Submit Edit or Delete for existing PDF form.
- fillpdf_form_import_form_submit in ./
fillpdf.admin.inc - Perform the import.
File
- ./
fillpdf.admin.inc, line 767 - Allows mappings of PDFs to site content.
Code
function fillpdf_import_mappings($pdf_form, $mappings) {
$fields = fillpdf_get_fields($pdf_form->fid);
$field_keys = array_keys($fields);
// Process the mappings.
foreach ($mappings as $pdf_key => $field_settings) {
if (in_array($pdf_key, $field_keys)) {
fillpdf_fields_create_update($pdf_form->fid, $pdf_key, $field_settings, TRUE);
}
else {
drupal_set_message(t('Your code contained field mappings for the PDF field key <em>@pdf_key</em>, but it does not exist on this form. Therefore, it was ignored.', array(
'@pdf_key' => $pdf_key,
)), 'warning');
}
}
drupal_set_message(t('Successfully imported matching PDF field keys. If any field mappings failed to import, they are listed above.'));
}