function pay::form_setup in Pay 6
Same name and namespace in other branches
- 7 includes/handlers/pay.inc \pay::form_setup()
2 calls to pay::form_setup()
- pay::form in includes/handlers/pay.inc
- pay::settings_form in includes/handlers/pay.inc
File
- includes/handlers/pay.inc, line 187
- The base class for the Payment API.
Class
- pay
- @file
The base class for the Payment API.
Code
function form_setup(&$form, &$form_state, $form_type = 'form') {
$handler = $this
->handler();
$key = $this->key;
if (!$form_state['submitted'] && isset($_REQUEST[$handler])) {
foreach ($_REQUEST[$handler] as $posted_name => $posted_val) {
$func = 'set_' . $posted_name;
if (method_exists($this, $func)) {
$this
->{$func}($posted_val);
}
}
}
if (!isset($form['#pay'])) {
$form['#pay'] = array();
$form['#after_build'][] = 'pay_after_build';
}
$values = (array) $this;
$values['type'] = $this->table;
$values['form'] = $form_type;
$values['form_type'] = $form_state['pay_form_type'];
$class = array(
'pay',
'pay-' . $form_type,
'pay-' . $handler,
'pay-' . $form_type . '-' . $form_state['pay_form_type'],
);
$form['#attributes']['class'] = empty($form['#attributes']['class']) ? join(' ', $class) : $form['#attributes']['class'] . ' ' . join(' ', $class);
$form['#pay'][] = $values;
$form[$handler]['#tree'] = TRUE;
$form[$handler]['#group'] = $handler;
}