You are here

function fillpdf_form_import_form_validate in FillPDF 6

Same name and namespace in other branches
  1. 7.2 fillpdf.admin.inc \fillpdf_form_import_form_validate()
  2. 7 fillpdf.admin.inc \fillpdf_form_import_form_validate()

File

./fillpdf.admin.inc, line 520
Allows mappings of PDFs to site content

Code

function fillpdf_form_import_form_validate($form, &$form_state) {
  if (function_exists('json_decode')) {
    $mappings = json_decode($form_state['values']['code'], TRUE);
  }
  else {
    $mappings = fillpdf_safe_unserialize($form_state['values']['code']);
  }
  if (empty($mappings) || !is_array($mappings)) {
    form_set_error('code', t('There was a problem processing your Fill PDF Field Mappings code. Please do a fresh export from the source and try pasting it again.'));
  }
  else {
    $form_state['values']['mappings'] = $mappings;
  }
}