You are here

function theme_addresses_pane in Ubercart Addresses 5

Theme the address forms in tables.

Parameters

$form The address form to theme.:

Return value

The themed form (as a string).

File

./uc_addresses_address_pane.inc, line 193
This file contains the callbacks for the default address panes and their corresponding helper functions.

Code

function theme_addresses_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 ($field == 'aid') {
      continue;
    }
    $title = $form[$field]['#title'] . ':';
    unset($form[$field]['#title']);
    if (substr($field, 9) == 'street1') {
      $title = uc_get_field_name('street') . ':';
    }
    elseif (substr($field, 9) == '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;
}