You are here

function pay_form::pay_method_form in Pay 7

Same name and namespace in other branches
  1. 6 includes/handlers/pay_form.inc \pay_form::pay_method_form()

@todo Please document this function.

See also

http://drupal.org/node/1354

1 call to pay_form::pay_method_form()
pay_form::form in includes/handlers/pay_form.inc

File

includes/handlers/pay_form.inc, line 228
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,
  );
}