You are here

function pay_form_callback in Pay 7

Same name and namespace in other branches
  1. 6 pay.module \pay_form_callback()

A helper function for FAPI validate/submit callbacks. Locates any pay elements in a form and calls thier handler code.

3 calls to pay_form_callback()
pay_form_alter in ./pay.module
Implements hook_form_alter(). Pass the form to any applicable pay handlers in case they have some input.
pay_submit in ./pay.module
A FAPI submit handler for any type of pay form.
pay_validate in ./pay.module
A FAPI validate handler for any type of pay form.

File

./pay.module, line 409
Pay module allows for accepting payments using pluggable payment backends.

Code

function pay_form_callback($callback, &$form, &$form_state) {
  if (isset($form['#pay'])) {
    foreach ($form['#pay'] as $key => $item) {
      if ($pay = pay_load_object($item['type'], $item)) {
        $func = isset($item['form']) ? $item['form'] : 'form';
        $func .= '_' . $callback;
        if (method_exists($pay, $func)) {
          $pay
            ->{$func}($form, $form_state);
        }
        $form_state['pay'][$key] = $pay;
      }
    }
  }
}