You are here

function hook_commerce_checkout_pane_info in Commerce Core 7

Defines checkout panes available for use on checkout pages.

Any number of panes may be assigned to a page and reordered using the checkout form builder. Each pane may also have its own settings form accessible from the builder. On the checkout page, a pane is represented as a fieldset or container div. Panes possess a variety of callbacks used to define settings and checkout form elements and validate / process submitted data when the checkout form is submitted.

The Checkout module defines a couple of checkout panes in its own implementation of this hook, commerce_checkout_commerce_checkout_pane_info():

  • Review: the main pane on the default Review page that displays details from other checkout panes for the user to review prior to completion
  • Completion message: the main pane on the default Complete page that displays the checkout completion message and links

Other checkout panes are defined by the Cart, Customer, and Payment modules as follows:

  • Shopping cart contents: displays a View listing the contents of the shopping cart order with a summary including the total cost and number of items but no links (as used in the cart block)
  • Customer profile panes: the Customer module defines one for each type of customer information profile using the name of the profile type as the title of the pane
  • Payment: the main payment pane that lets the customer select a payment method and supply any necessary payment details; appears on the Review page beneath the Review pane by default, allowing payments to be processed immediately on submission for security purposes
  • Off-site payment redirect: a pane that handles redirected payment services with some specialized behavior; should be the only pane on the actual payment page

The checkout pane array contains properties that directly affect the pane’s fieldset display on the checkout form. It also contains a property used to automatically populate an array of callback function names.

The full list of properties is as follows:

  • pane_id: machine-name identifying the pane using lowercase alphanumeric characters, -, and _
  • title: the translatable title used for this checkout pane as the fieldset title in checkout
  • name: the translatable name of the pane, used in administrative displays; if not specified, defaults to the title
  • page: the page_id of the checkout page the pane should appear on by default; defaults to ‘checkout’
  • fieldset: boolean that defines if the pane should render as a fieldset or container element.
  • locked: boolean indicating that the pane cannot be moved from the specified checkout page.
  • collapsible: boolean indicating whether or not the checkout pane’s fieldset should be collapsible; defaults to FALSE
  • collapsed: boolean indicating whether or not the checkout pane’s fieldset should be collapsed by default; defaults to FALSE
  • weight: integer weight of the page used for determining the pane sort order on checkout pages; defaults to 0
  • enabled: boolean indicating whether or not the pane is enabled by default; defaults to TRUE
  • review: boolean indicating whether or not the pane should be included in the review checkout pane; defaults to TRUE
  • module: the name of the module that defined the pane; should not be set by the hook but will be populated automatically when the pane is loaded
  • file: the filepath of an include file relative to the pane’s module containing the callback functions for this pane, allowing modules to store checkout pane code in include files that only get loaded when necessary (like the menu item file property)
  • base: string used as the base for the magically constructed callback names, each of which will be defaulted to [base]_[callback] unless explicitly set; defaults to the pane_id
  • callbacks: an array of callback function names for the various types of callback required for all the checkout pane operations, arguments per callback in parentheses:

    • settings_form($checkout_pane): returns form elements for the pane’s settings form
    • checkout_form($form, &$form_state, $checkout_pane, $order): returns form elements for the pane’s checkout form fieldset
    • checkout_form_validate($form, &$form_state, $checkout_pane, $order): validates data inputted via the pane’s elements on the checkout form and must return TRUE or FALSE indicating whether or not all the data validated
    • checkout_form_submit($form, &$form_state, $checkout_pane, $order): processes data inputted via the pane’s elements on the checkout form, often updating parts of the order object based on the data
    • review($form, $form_state, $checkout_pane, $order): returns data used in the construction of the Review checkout pane

The helper function commerce_checkout_pane_callback() will include a checkout pane’s include file if specified and check for the existence of a callback, returning either the name of the function or FALSE if the specified callback does not exist for the specified pane.

Return value

An array of checkout pane arrays keyed by pane_id.

See also

commerce_checkout_pane_callback()

5 functions implement hook_commerce_checkout_pane_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commerce_cart_commerce_checkout_pane_info in modules/cart/commerce_cart.module
Implements hook_commerce_checkout_pane_info().
commerce_checkout_commerce_checkout_pane_info in modules/checkout/commerce_checkout.module
Implements hook_commerce_checkout_pane_info().
commerce_customer_commerce_checkout_pane_info in modules/customer/commerce_customer.module
Implements hook_commerce_checkout_pane_info().
commerce_order_commerce_checkout_pane_info in modules/order/commerce_order.module
Implements hook_commerce_checkout_pane_info().
commerce_payment_commerce_checkout_pane_info in modules/payment/commerce_payment.module
Implements hook_commerce_checkout_pane_info().
1 invocation of hook_commerce_checkout_pane_info()
commerce_checkout_panes in modules/checkout/commerce_checkout.module
Return a filtered array of checkout pane objects.

File

modules/checkout/commerce_checkout.api.php, line 271
Hooks provided by the Checkout module.

Code

function hook_commerce_checkout_pane_info() {
  $checkout_panes = array();
  $checkout_panes['checkout_review'] = array(
    'title' => t('Review'),
    'file' => 'includes/commerce_checkout.checkout_pane.inc',
    'base' => 'commerce_checkout_review_pane',
    'page' => 'review',
    'fieldset' => FALSE,
    'locked' => FALSE,
  );
  return $checkout_panes;
}