You are here

function theme_address_pane in Ubercart 6.2

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

Themes the delivery/billing address forms in tables.

See also

uc_checkout_pane_delivery()

uc_checkout_pane_billing()

File

uc_cart/uc_cart_checkout_pane.inc, line 447
Callbacks for the default Ubercart checkout panes and their corresponding helper functions.

Code

function theme_address_pane($form) {
  $output = '';
  $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">';
      $output .= '<label for="' . $form[$field]['#id'] . '">';
      if ($form[$field]['#required']) {
        $output .= $req;
      }
      $output .= $title . '</label></td>';
      $output .= '<td>' . drupal_render($form[$field]) . '</td></tr>';
    }
  }
  $output .= '</table></div>';
  foreach (element_children($form) as $element) {
    $output .= drupal_render($form[$element]);
  }
  return $output;
}