function uc_payment_methods_form in Ubercart 5
Same name and namespace in other branches
- 6.2 payment/uc_payment/uc_payment.admin.inc \uc_payment_methods_form()
- 7.3 payment/uc_payment/uc_payment.admin.inc \uc_payment_methods_form()
2 string references to 'uc_payment_methods_form'
- uc_credit_form_alter in payment/
uc_credit/ uc_credit.module - Implementation of hook_form_alter().
- uc_payment_menu in payment/
uc_payment/ uc_payment.module - Implementation of hook_menu().
File
- payment/
uc_payment/ uc_payment.module, line 385
Code
function uc_payment_methods_form() {
$methods = _payment_method_list();
$form['methods_info'] = array(
'#value' => '<div><strong>' . t('Payment methods') . '</strong><br />' . t('The settings forms below are for the payment methods defined by enabled modules. Click a name to expand its options and adjust the settings accordingly. Methods are listed in order of appearance on the checkout screen, determined by the weight setting (current value shown in parentheses).') . '</div><br />',
);
$form['pmtable'] = array(
'#theme' => 'uc_payment_method_table',
);
if (is_array($methods) && count($methods) > 0) {
foreach ($methods as $method) {
$form['pmtable'][$method['id']]['uc_payment_method_' . $method['id'] . '_checkout'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('uc_payment_method_' . $method['id'] . '_checkout', $method['checkout']),
);
$form['pmtable'][$method['id']]['name'] = array(
'#value' => $method['name'],
);
$form['pmtable'][$method['id']]['uc_payment_method_' . $method['id'] . '_weight'] = array(
'#type' => 'weight',
'#default_value' => variable_get('uc_payment_method_' . $method['id'] . '_weight', $method['weight']),
);
if ($method['no_gateway'] === TRUE) {
$form['pmtable'][$method['id']]['uc_payment_' . $method['id'] . '_gateway'] = array(
'#value' => '-',
);
}
else {
$gateways = _payment_gateway_list($method['id'], TRUE);
$options = array();
$default = FALSE;
if (is_array($gateways)) {
foreach ($gateways as $gateway) {
if (!$default) {
$default = $gateway['id'];
}
$options[$gateway['id']] = $gateway['title'];
}
}
if (!$default) {
$options = array(
'none' => t('None available.'),
);
}
$form['pmtable'][$method['id']]['uc_payment_' . $method['id'] . '_gateway'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => variable_get('uc_payment_' . $method['id'] . '_gateway', 'none'),
);
}
$null = NULL;
$method_settings = $method['callback']('settings', $null);
if (is_array($method_settings)) {
$form['method_' . $method['id']] = array(
'#type' => 'fieldset',
'#title' => t('!method settings', array(
'!method' => $method['name'],
'!weight' => $method['weight'],
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['method_' . $method['id']] = array_merge($form['method_' . $method['id']], $method_settings);
}
}
}
return system_settings_form($form);
}