function fillpdf_field in FillPDF 7
Same name and namespace in other branches
- 6 fillpdf.admin.inc \fillpdf_field()
- 7.2 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 787 - Allows mappings of PDFs to site content.
Code
function fillpdf_field($op, $fid, $pdf_key = NULL) {
if (is_numeric($fid)) {
$pdf_form = fillpdf_load($fid, FALSE, FALSE);
}
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);
}