Skip navigation


7 uc_cart.api.php uc_checkout_pane_callback($op, $order, $form = NULL, &$form_state = NULL)

Builds and proceses a pane defined by hook_uc_checkout_pane().


$op: The operation the pane is performing. Possible values are "view", "process", "review", and "settings".

$order: The order being viewed or edited.

$form: The order's edit form. NULL for non-edit ops.

&$form_state: The form state array of the edit form. NULL for non-edit ops.

Return value

Varies according to the value of $op:

  • view: An array with two keys, "contents" and an optional "description". "contents" is a form array to collect the checkout data for the pane. The description provides help text for the pane as a whole.
  • process: A boolean indicating that checkout should continue. During this op, $order should be modified with the values in $form_state['values']['panes'][PANE_ID].
  • review: An array containing review sections. A review section contains "title" and "data" keys which have HTML to be displayed on the checkout review page.
  • settings: A settings form which can be used with system_settings_form().

Related topics


ubercart/uc_cart/uc_cart.api.php, line 393
Hooks provided by the Cart module.


function uc_checkout_pane_callback($op, $order, $form = NULL, &$form_state = NULL) {
  // uc_checkout_pane_comments()
  switch ($op) {
    case 'view':
      $description = t('Use this area for special instructions or questions regarding your order.');

      if (!empty($order->order_id)) {
        $default = db_query("SELECT message FROM {uc_order_comments} WHERE order_id = :id", array(':id' => $order->order_id))->fetchField();
      else {
        $default = NULL;
      $contents['comments'] = array(
        '#type' => 'textarea', 
        '#title' => t('Order comments'), 
        '#default_value' => $default,

      return array('description' => $description, 'contents' => $contents);

    case 'process':
      if ($form_state['values']['panes']['comments']['comments']) {
          ->condition('order_id', $order->order_id)
        uc_order_comment_save($order->order_id, 0, $form_state['values']['panes']['comments']['comments'], 'order', uc_order_state_default('post_checkout'), TRUE);
      return TRUE;

    case 'review':
      $review = NULL;
      $result = db_query("SELECT message FROM {uc_order_comments} WHERE order_id = :id", array(':id' => $order->order_id));
      if ($comment = $result->fetchObject()) {
        $review[] = array(
          'title' => t('Comment'),
          'data' => check_plain($comment->message),
      return $review;