function pay_admin_settings in Pay 7
Same name and namespace in other branches
- 6 includes/pay.admin.inc \pay_admin_settings()
Overall settings form for global payment options.
1 string reference to 'pay_admin_settings'
- pay_admin_overview in includes/
pay.admin.inc - Payment settings overview.
File
- includes/
pay.admin.inc, line 22 - Administration form settings and related functions.
Code
function pay_admin_settings($form, &$form_state) {
$list = array(
'' => t('Please select'),
);
$list += pay_currency_list();
$form = array();
// Don't allow this to be changed if it has already been used and we don't
// support multi-currency. This would cause some forms and transactions
// to have a different currency than others without support for conversion.
$disabled = FALSE;
if (!variable_get('pay_currency_multiple', FALSE)) {
$disabled = $disabled || db_query("SELECT count(1)\n FROM {pay_transaction} WHERE currency IS NOT NULL AND currency != ''")
->fetchField();
}
$form['pay_currency'] = array(
'#type' => 'select',
'#title' => t('Currency'),
'#description' => t('The default currency for all payment activities on this site. This cannot be changed once transactions have been created.'),
'#options' => $list,
'#required' => TRUE,
'#default_value' => variable_get('pay_currency', NULL),
'#disabled' => $disabled,
);
// system_settings_form trounces the default submit handler, so define one.
$form['#submit'] = array(
'pay_admin_settings_submit',
);
return system_settings_form($form);
}