You are here

function email_mail_page_form in Email Field 7

Same name and namespace in other branches
  1. 5 email.module \email_mail_page_form()
  2. 6.2 email.module \email_mail_page_form()
  3. 6 email.module \email_mail_page_form()

Contact form

1 string reference to 'email_mail_page_form'
email_mail_page in ./email.module
The contact form page.

File

./email.module, line 342
Module file for the email module, which creates a email address field.

Code

function email_mail_page_form($form, $form_state, $object_type, $object_id, $field_name, $email) {
  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['email'] = array(
    '#type' => 'value',
    '#value' => $email,
  );
  $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_mail_page_form_validate',
    ),
    '#submit' => array(
      'email_mail_page_form_submit',
    ),
  );
  return $form;
}