function commerce_coupon_pane_settings_form in Commerce Coupon 7
Same name and namespace in other branches
- 7.2 includes/commerce_coupon.checkout_pane.inc \commerce_coupon_pane_settings_form()
Checkout pane callback: returns the cart contents pane's settings form.
File
- includes/
commerce_coupon.checkout_pane.inc, line 191 - Coupon checkout panes.
Code
function commerce_coupon_pane_settings_form($checkout_pane) {
$form = array();
// Build an options array of Views available for the cart contents pane.
$options = array();
// Generate an option list from all user defined and module defined views.
foreach (views_get_all_views() as $view_id => $view_value) {
// Only include line item Views.
if ($view_value->base_table == 'commerce_coupon') {
foreach ($view_value->display as $display_id => $display_value) {
$options[check_plain($view_id)][$view_id . '|' . $display_id] = check_plain($display_value->display_title);
}
}
}
$form['commerce_coupon_checkout_pane_view'] = array(
'#type' => 'select',
'#title' => t('Coupons Checkout Pane View'),
'#description' => t('Specify the View to use in the checkout pane under the coupon form. Select \'none\' to not display anything.'),
'#options' => array(
'none' => t('None'),
) + $options,
'#default_value' => variable_get('commerce_coupon_checkout_pane_view', 'commerce_coupon_review_pane|checkout'),
);
$form['commerce_coupon_review_pane_view'] = array(
'#type' => 'select',
'#title' => t('Coupons Review Pane View'),
'#description' => t('Specify the View to use in the review pane to display the coupons.'),
'#options' => $options,
'#default_value' => variable_get('commerce_coupon_review_pane_view', 'commerce_coupon_review_pane|checkout'),
);
$form['commerce_coupon_checkout_enable_add_button'] = array(
'#type' => 'checkbox',
'#title' => t('Enable <em>Add coupon</em> button'),
'#description' => t('Enabling <em>Add coupon</em> button provides option to add multiple coupon codes from <em>Coupons</em> checkout pane.'),
'#default_value' => variable_get('commerce_coupon_checkout_enable_add_button', TRUE),
);
return $form;
}