You are here

function theme_uc_shipping_address in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_shipping/uc_shipping.module \theme_uc_shipping_address()

Compact the address into a table.

1 theme call to theme_uc_shipping_address()
uc_shipping_address_form in shipping/uc_shipping/uc_shipping.module

File

shipping/uc_shipping/uc_shipping.module, line 1007
Organizes ordered products into packages and sets them up for shipment. Shipping method modules may add functionality to generate shipping labels and tracking numbers.

Code

function theme_uc_shipping_address($address) {
  drupal_add_css(drupal_get_path('module', 'uc_cart') . '/uc_cart.css');
  if ($address['#collapsed']) {
    $collapsed = ' collapsed';
  }
  $output = '<table class="pane-table" cellpadding="2">';
  $req = '<span class="form-required">*</span>';
  foreach (element_children($address) as $field) {
    list($type, $name) = explode('_', $field, 2);
    if ($address !== NULL) {
      $title = $address[$field]['#title'] . ':';
      unset($address[$field]['#title']);
      if ($name == 'street1') {
        $title = uc_get_field_name('street') . ':';
      }
      elseif ($name == 'street2') {
        $title = ' ';
      }
      $output .= '<tr><td class="field-label">';
      if ($address[$field]['#required']) {
        $output .= $req;
      }
      $output .= $title . '</td><td>' . drupal_render($address[$field]) . '</td></tr>';
    }
  }
  $output .= '</table>';
  foreach (element_children($address) as $element) {
    $output .= drupal_render($address[$element]);
  }
  return $output;
}