You are here

function commerce_paypal_ec_review_pane_settings_form in Commerce PayPal 7.2

Checkout pane callback: returns the Express Checkout pane's settings form.

File

modules/ec/includes/commerce_paypal_ec.checkout_pane.inc, line 11
Checkout pane callback functions for the PayPal Express Checkout module.

Code

function commerce_paypal_ec_review_pane_settings_form($checkout_pane) {
  $form = array();

  // List the core checkout panes to exclude from the review and confirm page.
  $excluded_panes = array(
    'account',
    'cart_contents',
    'commerce_payment',
    'commerce_payment_redirect',
    'checkout_review',
    'checkout_completion_message',
    'paypal_ec_review',
  );

  // Create a list of checkout panes that may be included on the Express Checkout
  // review and order page. All core Commerce panes listed above and all panes
  // defined by the Customer module will be excluded.
  $options = array();
  foreach (commerce_checkout_panes() as $pane_id => $checkout_pane) {
    if (!in_array($pane_id, $excluded_panes) && $checkout_pane['module'] != 'commerce_customer') {
      $options[$pane_id] = check_plain($checkout_pane['name']);
    }
  }

  // If we have available checkout panes for this page...
  if (!empty($options)) {

    // Allow the administrator to choose which panes the customer should see
    // upon returning from Express Checkout.
    $form['commerce_paypal_ec_review_embedded_panes'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Checkout panes to include on the Express Checkout review and confirm page'),
      '#options' => $options,
      '#default_value' => variable_get('commerce_paypal_ec_review_embedded_panes', array()),
    );
  }
  return $form;
}