function fillpdf_field in FillPDF 7.2
Same name and namespace in other branches
- 6 fillpdf.admin.inc \fillpdf_field()
- 7 fillpdf.admin.inc \fillpdf_field()
Retrieve a field from a PDF for use in editing form.
1 string reference to 'fillpdf_field'
- fillpdf_menu in ./
fillpdf.module - Implements hook_menu().
File
- ./
fillpdf.admin.inc, line 577 - Allows mappings of PDFs to site content
Code
function fillpdf_field($op, $fid, $pdf_key = NULL) {
if (is_numeric($fid)) {
$pdf_form = db_query("SELECT * FROM {fillpdf_forms} WHERE fid = :fid", array(
':fid' => $fid,
))
->fetch();
}
if (!$pdf_form) {
drupal_not_found();
drupal_exit();
}
if ($op == 'add') {
drupal_set_title($pdf_form->title);
}
elseif ($op != 'edit') {
return fillpdf_form_overview($pdf_form);
}
elseif ($pdf_key) {
$pdf_key = rawurldecode(rawurldecode($pdf_key));
$field = db_query("SELECT * FROM {fillpdf_fields} WHERE pdf_key = :pdf_key AND fid = :fid", array(
':pdf_key' => $pdf_key,
':fid' => $fid,
))
->fetch();
if (!$field) {
drupal_not_found();
drupal_exit();
}
if (!empty($field->label)) {
$title = $field->label;
}
else {
$title = $field->pdf_key;
}
drupal_set_title(t('Edit field mapping for %field_title', array(
'%field_title' => $title,
)), PASS_THROUGH);
}
return drupal_get_form('fillpdf_field_edit', $pdf_form, $field);
}