You are here

function patron_email_form in Library 6

Same name and namespace in other branches
  1. 5.2 patron/patron.pages.inc \patron_email_form()
1 string reference to 'patron_email_form'
patron_menu in patron/patron.module
Implementation of hook_menu()

File

patron/patron.pages.inc, line 31
Functions for generating page displays related to the patron module

Code

function patron_email_form(&$form_state) {
  $form = array();
  $patron_id = arg(2);
  if ($patron_id) {
    $patron = patron_get_patrons($patron_id);
    $to = $patron[0]->email;
    $name = $patron[0]->name_first . ' ' . $patron[0]->name_last;
    if ($patron) {
      $form['to'] = array(
        '#type' => 'value',
        '#value' => $to ? $to : '',
        '#required' => FALSE,
      );
      $form['patron_name'] = array(
        '#type' => 'item',
        '#title' => t('To'),
        '#value' => $name,
        '#required' => FALSE,
      );
      $form['patron'] = array(
        '#type' => 'value',
        '#value' => $name,
        '#required' => FALSE,
      );
    }
  }
  $form['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#maxlength' => 255,
    '#required' => TRUE,
  );
  $form['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send E-mail'),
  );
  return $form;
}