You are here

function theme_uc_shipping_address in Ubercart 6.2

Same name and namespace in other branches
  1. 5 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
Helper function for addresses in forms.

File

shipping/uc_shipping/uc_shipping.module, line 351

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;
}