function fillpdf_import_mappings in FillPDF 7.2
Same name and namespace in other branches
- 7 fillpdf.admin.inc \fillpdf_import_mappings()
Import an array of decoded FillPDF mappings. For the format,
See also
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 554 - 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)) {
$field_settings = (object) $field_settings;
$field_settings->pdf_key = $pdf_key;
fillpdf_update_field($pdf_form, $field_settings, $pdf_key);
}
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.'));
}