You are here

function theme_uc_addresses_pane in Ubercart Addresses 5.2

Same name and namespace in other branches
  1. 6 uc_addresses_address_pane.inc \theme_uc_addresses_pane()

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 225
This file contains the callbacks for the default address panes and their corresponding helper functions.

Code

function theme_uc_addresses_pane($form) {
  $req = '<span class="form-required">*</span>';
  $output = '';
  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, -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;
}