You are here

function pay_form in Pay 6

Same name and namespace in other branches
  1. 7 pay.module \pay_form()

A simple form any type of pay element. If you want to build a module with a standalone payment form, you would do so by passing this function to the drupal_get_form page handler in your hook_menu() funcion.

Alternatively, you can manually add payment form capabilities by including the code from this function in your form builder or form_alter code.

1 call to pay_form()
pay_node_pay_form in modules/pay_node/pay_node.module
A callback for node/x/pay which presents a payment form.
16 string references to 'pay_form'
pay::permissions_settings in includes/handlers/pay.inc
pay_admin_pay_form_list in includes/pay.admin.inc
List payment forms
pay_form_load in ./pay.module
API Function: Load a payment form object.
pay_handler_field_amount::query in includes/views/pay_handler_field_amount.inc
pay_handler_field_count::query in includes/views/pay_handler_field_count.inc

... See full list

File

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

Code

function pay_form(&$form_state, $pay, $type = NULL, $form_type = 'default') {
  if ($type) {
    $pay = pay_load($type, $pay);
  }

  // Add a "build mode" to $form_state so that the form handlers can render
  // forms differently based on user-defined context.
  $form_state['pay_form_type'] = $form_type;

  // Allow this handler to alter in all of its form fields. This will also
  // add the appropriate validate and submit callbacks for the Payment API.
  $pay
    ->form($form, $form_state);

  // Add a submit button, if we think it's necessary.
  if (!isset($form['submit']) && !isset($form[$pay
    ->handler()]['submit'])) {
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit payment'),
    );
  }
  return $form;
}