You are here

public function BotchaRecipebook::apply in BOTCHA Spam Prevention 6.3

Same name and namespace in other branches
  1. 7.3 controller/recipebook/botcha.recipebook.controller.inc \BotchaRecipebook::apply()

File

controller/recipebook/botcha.recipebook.controller.inc, line 307
Controller layer of the BotchaRecipebook objects.

Class

BotchaRecipebook

Code

public function apply(&$form, &$form_state) {

  // @todo Abstract it.
  // '#input'=1 hacks FAPI to call #process handler on the form.
  $form += array(
    '#input' => TRUE,
  );
  $form['#process'][] = 'botcha_fprocess';

  //$form_state['no_cache'] = TRUE;

  // User_login forms open session in validate hooks instead of submit,
  // we should be the first to validate - add our hook to the beginning.
  if (is_array($form['#validate'])) {

    // Workaround since array_unshift'ing by reference was deprecated.
    // @link http://www.php.net/manual/en/function.array-unshift.php#40270 @endlink
    array_unshift($form['#validate'], '');
    $form['#validate'][0] = 'botcha_formValidate';
  }
  else {
    $form['#validate'] = array(
      'botcha_formValidate',
    );
  }

  // @todo ?Do we need it?
  $form_state['#botcha'] = $this->id;
}