You are here

function contact_spamapi_form_alter in Spam 6

Form alter gets its own function so we can reference &$form without causing errors in PHP4 installations. (If we use spamapi, we have to set a default, which PHP4 doesn't support.)

File

content/spam_content_contact.inc, line 191
Include file for integration with the contact form.

Code

function contact_spamapi_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'contact_mail_user':
      if (empty($form['#validate'])) {
        $form['#validate'] = array();
      }
      $form['#validate'] = array(
        'contact_spam_scan',
      ) + $form['#validate'];
      break;
    case 'contact_mail_page':
      if (empty($form['#validate'])) {
        $form['#validate'] = array();
      }
      $form['#validate'] = array(
        'contact_spam_scan',
      ) + $form['#validate'];
      break;
  }
}