You are here

function commerce_coupon_pane_settings_form in Commerce Coupon 7.2

Same name and namespace in other branches
  1. 7 includes/commerce_coupon.checkout_pane.inc \commerce_coupon_pane_settings_form()

Checkout pane callback: coupon settings.

File

includes/commerce_coupon.checkout_pane.inc, line 11
Commerce Checkout pane implementations.

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', 'order_coupon_list|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', 'order_coupon_list|checkout'),
  );
  return $form;
}