You are here

function theme_commerce_registration_review_pane in Commerce Registration 7.3

Theme callback for the checkout review pane.

1 theme call to theme_commerce_registration_review_pane()
commerce_registration_information_review in includes/commerce_registration.checkout_pane.inc
Commerce checkout pane review callback.

File

includes/commerce_registration.theme.inc, line 10
Commerce Registration theme functions.

Code

function theme_commerce_registration_review_pane($variables) {
  $registrations = $variables['registrations'];
  $settings = registration_entity_settings('commerce_product', $variables['product']->product_id
    ->value());
  $limit = $settings['settings']['limit_registrations'];
  $args = array(
    '!title' => $variables['product']->title
      ->value(),
    '%count' => format_plural(count($registrations), '1 registration', '@count registrations'),
  );
  $output = '<h3 class="commerce-product-title product-title">' . t('!title (%count)', $args) . '</h3><hr>';
  switch ($limit) {
    case 'registrations':

      // Multiple registrations per single quantity of product.
      $rows = array();
      foreach ($registrations as $key => $quantity) {
        $j = 1;
        $label = $key + 1;
        $qargs = array(
          '!title' => $args['!title'],
          '!count' => $label,
        );
        $rows[] = array(
          array(
            'data' => t('Registrations for !title - Quantity #!count', $qargs),
            'colspan' => 2,
            'header' => TRUE,
          ),
        );
        foreach ($quantity as $registration) {
          $row = array(
            array(
              'data' => t('Registrant #!count', array(
                '!count' => $j++,
              )),
            ),
            array(
              'data' => theme('commerce_registration_review_registration', array(
                'registration' => $registration,
              )),
            ),
          );
          $rows[] = $row;
        }
      }
      $output = theme('table', array(
        'rows' => $rows,
      ));
      break;
    case 'slots':

      // Single registration per single quantity of product, taking up multiple slots.
      $i = 1;
      $header = array(
        array(
          'data' => t('Registrations for !product', array(
            '!product' => $args['!title'],
          )),
          'colspan' => 2,
        ),
      );
      $rows = array();
      foreach ($registrations as $registration) {
        $row = array(
          array(
            'data' => t('Registrant #!count', array(
              '!count' => $i++,
            )),
          ),
          array(
            'data' => theme('commerce_registration_review_registration', array(
              'registration' => $registration,
            )),
          ),
        );
        $rows[] = $row;
      }
      $output = theme('table', array(
        'header' => $header,
        'rows' => $rows,
      ));
      break;
  }
  return $output;
}