You are here

function feedback_mail_form in Feedback 5

1 string reference to 'feedback_mail_form'
feedback_mail_page in ./feedback.module
Site-wide feedback page

File

./feedback.module, line 277
Enables a site-wide feedback page.

Code

function feedback_mail_form($page) {
  global $user;
  $form['instructions'] = array(
    '#value' => $page->instructions,
  );
  if ($page->field_name) {
    $form['emailname'] = array(
      '#type' => 'textfield',
      '#title' => t('Your full name'),
      '#default_value' => $user->uid ? $user->name : '',
      '#size' => 60,
      '#maxlength' => 64,
      '#description' => NULL,
      '#attributes' => NULL,
      '#required' => TRUE,
    );
  }
  $form['mail'] = array(
    '#type' => 'textfield',
    '#title' => t('Your e-mail address'),
    '#default_value' => $user->uid ? $user->mail : '',
    '#size' => 60,
    '#maxlength' => 64,
    '#description' => NULL,
    '#attributes' => NULL,
    '#required' => TRUE,
  );
  if ($page->field_postal) {
    $form['postal'] = array(
      '#type' => 'textarea',
      '#title' => t('Your postal address'),
      '#cols' => 50,
      '#rows' => 4,
    );
  }
  if ($page->field_phone) {
    $form['phone'] = array(
      '#type' => 'textfield',
      '#title' => t('Your phone number'),
      '#size' => 60,
      '#maxlength' => 64,
    );
  }
  if ($page->field_subject) {
    $form['subject'] = array(
      '#type' => 'textfield',
      '#title' => t('Subject'),
      '#size' => 60,
      '#maxlength' => 64,
      '#description' => NULL,
      '#attributes' => NULL,
      '#required' => TRUE,
    );
  }
  if ($page->field_category) {
    $form['category'] = array(
      '#type' => 'select',
      '#title' => t('Category'),
      '#options' => _feedback_get_options($page->field_category),
      '#description' => NULL,
      '#extra' => 0,
      '#multiple' => FALSE,
      '#required' => TRUE,
    );
  }
  if ($page->field_body) {
    $form['body'] = array(
      '#type' => 'textarea',
      '#title' => t('Message'),
      '#cols' => 60,
      '#rows' => 15,
      '#description' => NULL,
      '#attributes' => NULL,
      '#required' => TRUE,
    );
  }
  $form['referer'] = array(
    '#type' => 'hidden',
    '#value' => $_SERVER[HTTP_REFERER],
  );
  $form['op'] = array(
    '#type' => 'submit',
    '#value' => t('Send message'),
  );
  $form['page'] = array(
    '#type' => 'value',
    '#value' => $page,
  );
  return $form;
}