You are here

function fillpdf_field_edit in FillPDF 7.2

Same name and namespace in other branches
  1. 5 fillpdf.module \fillpdf_field_edit()
  2. 6 fillpdf.admin.inc \fillpdf_field_edit()
  3. 7 fillpdf.admin.inc \fillpdf_field_edit()

Edit a single field.

1 string reference to 'fillpdf_field_edit'
fillpdf_field in ./fillpdf.admin.inc
Retrieve a field from a PDF for use in editing form.

File

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

Code

function fillpdf_field_edit($form, &$form_state, $pdf_form, $field) {
  $form['pdf_key'] = array(
    '#type' => 'item',
    '#title' => t('PDF Key'),
    '#markup' => $field->pdf_key,
    '#description' => t('The field key contained in the PDF form.'),
    '#weight' => 0,
  );
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label'),
    '#maxlength' => 255,
    '#default_value' => $field->label,
    '#description' => t('An optional label to help you identify the field.'),
    '#weight' => 1,
  );
  $form['prefix'] = array(
    '#type' => 'textarea',
    '#title' => t('Prefix'),
    '#default_value' => $field->prefix,
    '#description' => t('<p>If there is some text you always want to appear before the main value if it isn\'t empty, enter it here. <strong>This value only appears if the token pattern in <em>Value</em> doesn\'t result in blank text.</strong></p>'),
    '#weight' => 3,
  );
  $form['value'] = array(
    '#type' => 'textarea',
    '#title' => t('Value'),
    '#default_value' => $field->value,
    '#description' => t('<p>The content that will populate this field when the PDF is printed/saved.
      This content pulls data via tokens, see below for available tokens.</p>
      <p>To fill this field with an image, use the special pseudo-token <strong>[stamp:field_name]</strong>.
      If your <em>Image</em> field is named <em>field_image</em>, then you would use
      <strong>[stamp:field_image]</strong>.</p>'),
    '#weight' => 4,
  );
  $form['tokens_fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => 'Tokens',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#weight' => 5,
  );
  $form['tokens_fieldset']['tokens'] = _fillpdf_admin_token_form();
  $form['suffix'] = array(
    '#type' => 'textarea',
    '#title' => t('Suffix'),
    '#default_value' => $field->suffix,
    '#description' => t('<p>If there is some text you always want to appear after the main value if it isn\'t empty, enter it here. <strong>This value only appears if the token pattern in <em>Value</em> doesn\'t result in blank text.</strong></p>'),
    '#weight' => 6,
  );
  $form['extra'] = array(
    '#type' => 'fieldset',
    '#title' => t('Transform values on this field'),
    '#collapsible' => TRUE,
    '#collapsed' => $field->replacements ? FALSE : TRUE,
    '#weight' => 7,
  );
  $form['extra']['replacements'] = array(
    '#type' => 'textarea',
    '#wysiwyg' => FALSE,
    '#description' => FILLPDF_REPLACEMENTS_DESCRIPTION,
    '#default_value' => $field->replacements,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
    '#weight' => 9,
  );
  $form['cancel'] = array(
    '#type' => 'link',
    '#title' => t('Cancel'),
    '#href' => 'admin/structure/fillpdf/' . $pdf_form->fid,
    '#weight' => 11,
  );
  $form['#pdf_field'] = $field;
  $form['#pdf_form'] = $pdf_form;
  return $form;
}