function theme_uc_addresses_list_address in Ubercart Addresses 6
Same name and namespace in other branches
- 5.2 uc_addresses.module \theme_uc_addresses_list_address()
- 5 uc_addresses.module \theme_uc_addresses_list_address()
Theme the address list view.
Parameters
$address The address object we are theming.:
$panes An associative array for each address pane.: The key is the pane's title and the value is either the data returned for that pane or an array of returned data.
Return value
The themed address.
1 theme call to theme_uc_addresses_list_address()
- _uc_addresses_list_one_address in ./
uc_addresses.module - List one address.
File
- ./
uc_addresses.module, line 833
Code
function theme_uc_addresses_list_address($address, $panes) {
global $user;
$uid = $address->uid;
$aid = $address->aid;
drupal_add_css(drupal_get_path('module', 'uc_addresses') . '/uc_addresses.css');
$output = '';
if ($address->is_default) {
$output = '<table class="address-preview-table addresses-default-address">';
}
else {
$output = '<table class="address-preview-table">';
}
foreach ($panes as $title => $data) {
// We add an edit link only if the user is allowed to edit this address
if (user_access(UC_ADDRESSES_ACCESS_ADD_EDIT) || $user->uid == $uid) {
$output .= '<tr class="pane-title-row"><td colspan="2">' . l(t('Edit this address'), 'user/' . $uid . '/addresses/' . $aid . '/edit') . ($address->is_default ? '' : ' | ' . l(t('Delete this address'), 'user/' . $uid . '/addresses/' . $aid . '/delete')) . '</td></tr>';
}
if ($address->is_default) {
$output .= '<tr><td colspan="2" class="addresses-default-address-label"> ' . t('Default address') . '</td></tr>';
}
if ($address->address_name) {
$output .= '<tr class="pane-data-row"><td class="title-col" ' . '>' . t('Name') . ':</td><td class="data-col">' . check_plain($address->address_name) . '</td></tr>';
}
if (is_array($data)) {
foreach ($data as $row) {
if (is_array($row)) {
if (isset($row['border'])) {
$border = ' class="row-border-' . $row['border'] . '"';
}
else {
$border = '';
}
$output .= '<tr class="pane-data-row"' . $border . '><td class="title-col" ' . '>' . $row['title'] . ':</td><td class="data-col">' . $row['data'] . '</td></tr>';
}
else {
$output .= '<tr class="pane-data-row"><td colspan="2">' . $row . '</td></tr>';
}
}
}
else {
$output .= '<tr class="pane-data-row"><td colspan="2">' . $data . '</td></tr>';
}
}
$output .= '</table><br />';
return $output;
}