function _uc_varprice_feature_form in UC Variable Price 7
Same name and namespace in other branches
- 6 uc_varprice.module \_uc_varprice_feature_form()
2 calls to _uc_varprice_feature_form()
- uc_varprice_feature_form in ./uc_varprice.module
- Settings form for individual Variable Price product features.
- uc_varprice_form_alter in ./uc_varprice.module
- Implements hook_form_alter().
File
- ./uc_varprice.module, line 299
- Defines a product feature to turn any product into a variable priced product.
Code
function _uc_varprice_feature_form($varprice_feature = FALSE) {
$form = array();
$form['prices'] = array(
'#type' => 'fieldset',
'#title' => t('Price settings'),
);
$form['prices']['price_default'] = array(
'#type' => 'textfield',
'#title' => t('Default price'),
'#size' => 8,
'#description' => t('The default price for this variable priced products.'),
'#default_value' => $varprice_feature ? $varprice_feature->price_default : variable_get('uc_varprice_global_default', '0'),
'#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
'#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '',
);
$form['prices']['price_minimum'] = array(
'#type' => 'textfield',
'#title' => t('Minimum price'),
'#size' => 8,
'#description' => t('The minimum price required for this product to be added to the cart.<br />Leave blank for no minimum.'),
'#default_value' => $varprice_feature ? $varprice_feature->price_minimum : '',
'#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
'#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '',
);
$form['prices']['price_maximum'] = array(
'#type' => 'textfield',
'#title' => t('Maximum price'),
'#size' => 8,
'#description' => t('The maximum price allowed for this product to be added to the cart.<br />Leave blank for no maximum.'),
'#default_value' => $varprice_feature ? $varprice_feature->price_maximum : '',
'#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
'#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '',
);
$form['titles'] = array(
'#type' => 'fieldset',
'#title' => t('Add to cart form element titles'),
'#description' => t('Use these settings to adjust the normal titles of add to cart form elements for variable priced products.'),
);
$form['titles']['override_add_to_cart_title'] = array(
'#type' => 'checkbox',
'#title' => t('Override the title of the add to cart button.'),
'#description' => t('Defaults to <em>Add to cart</em>. For multilingual sites, use <a href="!url">String Overrides</a> instead.', array(
'!url' => url('http://drupal.org/project/stringoverrides', array(
'absolute' => TRUE,
)),
)),
'#default_value' => $varprice_feature ? !empty($varprice_feature->add_to_cart_title) : FALSE,
'#attributes' => array(
'class' => array(
'override-checkbox',
),
),
);
$form['titles']['add_to_cart_title'] = array(
'#type' => 'textfield',
'#title' => t('Add to cart button title'),
'#default_value' => $varprice_feature && !empty($varprice_feature->add_to_cart_title) ? $varprice_feature->add_to_cart_title : t('Add to cart'),
);
$form['titles']['override_amount_title'] = array(
'#type' => 'checkbox',
'#title' => t('Override the title of the amount field for the price on the add to cart form.'),
'#description' => t('Defaults to <em>Amount</em>. For multilingual sites, use <a href="!url">String Overrides</a> instead.', array(
'!url' => url('http://drupal.org/project/stringoverrides', array(
'absolute' => TRUE,
)),
)),
'#default_value' => $varprice_feature ? !empty($varprice_feature->amount_title) : FALSE,
'#attributes' => array(
'class' => array(
'override-checkbox',
),
),
);
$form['titles']['amount_title'] = array(
'#type' => 'textfield',
'#title' => t('Amount field title'),
'#default_value' => $varprice_feature && !empty($varprice_feature->amount_title) ? $varprice_feature->amount_title : t('Amount'),
);
return $form;
}