You are here

function pay_form::pay_method_form in Pay 6

Same name and namespace in other branches
  1. 7 includes/handlers/pay_form.inc \pay_form::pay_method_form()
1 call to pay_form::pay_method_form()
pay_form::form in includes/handlers/pay_form.inc

File

includes/handlers/pay_form.inc, line 202
The base class for payment activities. All payment form classes should extend this.

Class

pay_form
@file The base class for payment activities. All payment form classes should extend this.

Code

function pay_method_form(&$form, &$form_state) {
  $group = $this
    ->handler();
  $methods = $this
    ->pay_methods();
  $form[$group]['pay_method']['selected'] = array();
  foreach ($methods as $pmid => $pay_method) {
    $options[$pmid] = $pay_method->title;
    $pay_method
      ->form($form, $form_state);

    // Make sure each payment method has a total.
    if (!isset($form[$group]['pay_method'][$pmid]['total'])) {
      $form[$group]['pay_method'][$pmid]['total'] = array(
        '#type' => 'value',
        '#value' => 0.0,
      );
    }
  }
  $form[$group]['pay_method']['selected'] = array(
    '#type' => 'radios',
    '#options' => $options,
    '#required' => TRUE,
    '#access' => count($methods) > 1,
    '#default_value' => count($methods) == 1 ? $methods : NULL,
  );
}