You are here

function commerce_payment_pane_settings_form in Commerce Core 7

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

File

modules/payment/includes/commerce_payment.checkout_pane.inc, line 19
Callback functions for the Payment module's checkout panes.

Code

function commerce_payment_pane_settings_form($checkout_pane) {
  $form = array();
  $form['commerce_payment_pane_require_method'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require a payment method at all times, preventing checkout if none is available.'),
    '#default_value' => variable_get('commerce_payment_pane_require_method', FALSE),
  );
  $form['commerce_payment_pane_no_method_behavior'] = array(
    '#type' => 'radios',
    '#title' => t('Checkout pane behavior when no payment methods are enabled for an order'),
    '#description' => t('Note: regardless of your selection, no payment transaction will be created for the order upon checkout completion as they represent actual financial transactions.'),
    '#options' => array(
      COMMERCE_PAYMENT_PANE_NO_METHOD_EMPTY => t('Leave the payment checkout pane empty.'),
      COMMERCE_PAYMENT_PANE_NO_METHOD_EMPTY_EVENT => t('Leave the payment checkout pane empty and trigger <em>When an order is first paid in full</em> on submission of free orders.'),
      COMMERCE_PAYMENT_PANE_NO_METHOD_MESSAGE => t('Display a message in the pane indicating payment is not required for the order.'),
      COMMERCE_PAYMENT_PANE_NO_METHOD_MESSAGE_EVENT => t('Display a message in the pane indicating payment is not required and trigger <em>When an order is first paid in full</em> on submission of free orders.'),
    ),
    '#default_value' => variable_get('commerce_payment_pane_no_method_behavior', COMMERCE_PAYMENT_PANE_NO_METHOD_MESSAGE),
    '#states' => array(
      'visible' => array(
        ':input[name="commerce_payment_pane_require_method"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  return $form;
}