You are here

function theme_commerce_checkout_review in Commerce Core 7

Themes the optional checkout review page data.

1 theme call to theme_commerce_checkout_review()
commerce_checkout_review_pane_checkout_form in modules/checkout/includes/commerce_checkout.checkout_pane.inc
Checkout pane callback: returns a pane allowing the customer to review the details of the order.

File

modules/checkout/includes/commerce_checkout.pages.inc, line 459
The page and form callbacks for use in the checkout form.

Code

function theme_commerce_checkout_review($variables) {
  $form = $variables['form'];

  // Turn the review data array into table rows.
  $rows = array();
  foreach ($form['#data'] as $pane_id => $data) {

    // First add a row for the title.
    $rows[] = array(
      'data' => array(
        array(
          'data' => $data['title'],
          'colspan' => 2,
        ),
      ),
      'class' => array(
        'pane-title',
        'odd',
      ),
    );

    // Next, add the data for this particular section.
    if (is_array($data['data'])) {

      // If it's an array, treat each key / value pair as a 2 column row.
      foreach ($data['data'] as $key => $value) {
        $rows[] = array(
          'data' => array(
            array(
              'data' => $key . ':',
              'class' => array(
                'pane-data-key',
              ),
            ),
            array(
              'data' => $value,
              'class' => array(
                'pane-data-value',
              ),
            ),
          ),
          'class' => array(
            'pane-data',
            'even',
          ),
        );
      }
    }
    else {

      // Otherwise treat it as a block of text in its own row.
      $rows[] = array(
        'data' => array(
          array(
            'data' => $data['data'],
            'colspan' => 2,
            'class' => array(
              'pane-data-full',
            ),
          ),
        ),
        'class' => array(
          'pane-data',
          'even',
        ),
      );
    }
  }
  return theme('table', array(
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'checkout-review',
      ),
    ),
  ));
}