You are here

function fillpdf_form_edit in FillPDF 5

Same name and namespace in other branches
  1. 6 fillpdf.admin.inc \fillpdf_form_edit()
  2. 7.2 fillpdf.admin.inc \fillpdf_form_edit()
  3. 7 fillpdf.admin.inc \fillpdf_form_edit()
1 string reference to 'fillpdf_form_edit'
fillpdf_menu in ./fillpdf.module
Implementation of hook_menu().

File

./fillpdf.module, line 163
Allows mappings of PDFs to site content

Code

function fillpdf_form_edit($op = 'add', $fid = NULL) {
  if ($op != 'add' && is_numeric($fid)) {
    $pdf_form = db_fetch_object(db_query("SELECT * FROM {fillpdf_forms} WHERE fid = %d", $fid));
    drupal_set_title(t('Edit form'));
  }
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#maxlength' => 127,
    '#default_value' => $pdf_form ? $pdf_form->title : '',
    '#required' => TRUE,
    '#weight' => -5,
  );
  $form['url'] = array(
    '#type' => 'textfield',
    '#title' => t('URL'),
    '#description' => t('The URL of the PDF file that will be parsed & merged.
							Currently, this module doesn\'t upload, so if you want the PDF file on your
							own server, upload it via one of Drupal\'s many uploading mechanisms (or FTP)
							and paste the http:// url here.'),
    '#maxlength' => 127,
    '#default_value' => $pdf_form ? $pdf_form->url : '',
    '#required' => TRUE,
    '#weight' => -5,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#weight' => 15,
  );
  if ($pdf_form) {
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
      '#weight' => 16,
    );
  }
  else {
    $pdf_form = (object) array(
      'new' => TRUE,
    );
  }
  $form['form'] = array(
    '#type' => 'value',
    '#value' => &$pdf_form,
  );
  $form['#validate'] = array(
    'fillpdf_form_edit_validate' => array(),
  );
  $form['#submit'] = array(
    'fillpdf_form_edit_submit' => array(),
  );
  return $form;
}