function commerce_coupon_ui_settings_form in Commerce Coupon 7
Commerce coupon settings form.
1 string reference to 'commerce_coupon_ui_settings_form'
- commerce_coupon_ui_menu in ./
commerce_coupon_ui.module - Implements hook_menu().
File
- includes/
commerce_coupon_ui.settings.inc, line 11 - Coupon general settings.
Code
function commerce_coupon_ui_settings_form($form, &$form_state) {
$form['commerce_coupon_default_code_size'] = array(
'#type' => 'textfield',
'#title' => t('Coupon Code Length'),
'#default_value' => variable_get('commerce_coupon_default_code_size', 8),
'#description' => t('Set the coupon code length for auto generated codes.'),
);
$form['commerce_coupon_coupon_upgrade_types'] = array(
'#type' => 'fieldset',
'#title' => t('Upgrade basic coupons'),
'#description' => t('If you\'re still using basic coupon type, you need to upgrade them either to percentage coupons or fixed amount coupons. This automated process will convert them based in the values of the percentage and amount fields. <br/><strong>Important note:</strong> If you have extra fields in the basic coupon type, add them to the percentage and/or fixed types, otherwhise the data will be lost'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
if (!module_exists('commerce_coupon_pct')) {
$form['commerce_coupon_coupon_upgrade_types']['warning_text'] = array(
'#markup' => t('Commerce coupon percentage is not installed thus percentage coupons won\'t be used as target for the basic coupon upgrade'),
);
}
if (!module_exists('commerce_coupon_fixed_amount')) {
$form['commerce_coupon_coupon_upgrade_types']['warning_text'] = array(
'#markup' => t('Commerce coupon fixed amount is not installed thus fixed amount coupons won\'t be used as target for the basic coupon upgrade'),
);
}
if (module_exists('commerce_coupon_pct') || module_exists('commerce_coupon_fixed_amount')) {
$form['commerce_coupon_coupon_upgrade_types']['upgrade_coupons'] = array(
'#type' => 'submit',
'#value' => t('Upgrade coupons'),
'#submit' => array(
'commerce_coupon_ui_settings_upgrade_coupons_submit',
),
);
}
return system_settings_form($form);
}