You are here

function theme_address_pane in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_cart/uc_cart_checkout_pane.inc \theme_address_pane()

File

uc_cart/uc_cart_checkout_pane.inc, line 426
This file contains the callbacks for the default checkout panes supplied with Ubercart and their corresponding helper functions.

Code

function theme_address_pane($form) {
  $req = '<span class="form-required">*</span>';
  if (isset($form['copy_address'])) {
    $output = drupal_render($form['copy_address']);
  }
  $output .= '<div class="address-pane-table"><table>';
  foreach (element_children($form) as $field) {
    if (substr($field, 0, 9) == 'delivery_' || substr($field, 0, 8) == 'billing_') {
      $title = $form[$field]['#title'] . ':';
      unset($form[$field]['#title']);
      if (substr($field, -7) == 'street1') {
        $title = uc_get_field_name('street') . ':';
      }
      elseif (substr($field, -7) == 'street2') {
        $title = ' ';
      }
      $output .= '<tr><td class="field-label">';
      if ($form[$field]['#required']) {
        $output .= $req;
      }
      $output .= $title . '</td><td>' . drupal_render($form[$field]) . '</td></tr>';
    }
  }
  $output .= '</table></div>';
  foreach (element_children($form) as $element) {
    $output .= drupal_render($form[$element]);
  }
  return $output;
}