You are here

function email_contact_mail_page_form in Email Contact 7

Contact form.

1 string reference to 'email_contact_mail_page_form'
email_contact_mail_page in ./email_contact.module
The contact form page.

File

./email_contact.module, line 343
File name: email_contact.module.

Code

function email_contact_mail_page_form($form, &$form_state, $object_type, $object_id, $field_name, $emails, $widget_settings = array()) {
  global $user;
  $form['object_id'] = array(
    '#type' => 'value',
    '#value' => $object_id,
  );
  $form['object_type'] = array(
    '#type' => 'value',
    '#value' => $object_type,
  );
  $form['field_name'] = array(
    '#type' => 'value',
    '#value' => $field_name,
  );
  $form['emails'] = array(
    '#type' => 'value',
    '#value' => serialize($emails),
  );
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Your name'),
    '#maxlength' => 255,
    '#default_value' => $user->uid ? $user->name : '',
    '#required' => TRUE,
  );
  $form['mail'] = array(
    '#type' => 'textfield',
    '#title' => t('Your e-mail address'),
    '#maxlength' => 255,
    '#default_value' => $user->uid ? $user->mail : '',
    '#required' => TRUE,
  );
  $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'),
    '#validate' => array(
      'email_contact_mail_page_form_validate',
    ),
    '#submit' => array(
      'email_contact_mail_page_form_submit',
    ),
  );
  if (!isset($form_state['widget_settings'])) {
    $form_state['widget_settings'] = $widget_settings;
  }
  return $form;
}