function theme_location in Location 5
Same name and namespace in other branches
- 5.3 location.d5.inc \theme_location()
Generates HTML for the passed location.
Parameters
$location: An associative array where 'street' => A string representing the street location 'additional' => A string for any additional portion of the street location 'city' => A string for the city name 'province' => The standard postal abbreviation for the province 'country' => The two-letter ISO code for the country of the location (REQUIRED) 'postal_code' => The international postal code for the location
$hide: An linear array where the values are the location fields to suppress in the themed display.
Return value
An HTML string with special tags for locations.
4 theme calls to theme_location()
- location_user in ./
location.module - location_views_field_handler_address in contrib/
location_views/ location_views.module - location_views_field_handler_user_address in contrib/
location_views/ location_views.module - theme_locations in ./
location.theme
File
- ./
location.theme, line 123
Code
function theme_location($location = array(), $hide = array()) {
if (_location_nothing_to_show($location, $hide)) {
return '';
}
$output = '';
if (isset($location['country']) && ($f = theme_get_function('location_' . $location['country']))) {
$output .= call_user_func($f, $location, $hide);
}
elseif (count($location)) {
$output .= "\n";
$output .= '<div class="location vcard"><div class="adr">' . "\n";
if (!empty($location['name']) && !in_array('name', $hide)) {
$output .= '<div class="fn">' . $location['name'] . '</div>';
}
if (!empty($location['street']) && !in_array('street', $hide)) {
$output .= '<div class="street-address">' . $location['street'];
if (!empty($location['additional']) && !in_array('street', $hide)) {
$output .= ' ' . $location['additional'];
}
$output .= '</div>';
}
if (!empty($location['city']) && !in_array('city', $hide)) {
$city_province_postal[] = $location['city'];
}
if (!empty($location['city']) && !in_array('city', $hide)) {
$output .= '<span class="locality">' . $location['city'] . '</span>';
if (!empty($location['province']) && !in_array('province', $hide)) {
$output .= ', ';
}
}
if (!empty($location['province']) && !in_array('province', $hide)) {
$output .= '<span class="region">' . $location['province'] . '</span> ';
}
if (!empty($location['postal_code']) && !in_array('postal_code', $hide)) {
$output .= ' <span class="postal-code">' . $location['postal_code'] . '</span>';
}
if (!empty($location['country']) && !in_array('country', $hide)) {
$countries = _location_get_iso3166_list();
$output .= '<div class="country-name">' . t($countries[$location['country']]) . '</div>';
}
if (isset($location['latitude']) && isset($location['longitude'])) {
$output .= '<div class="geo"><abbr class="latitude" title="' . $location['latitude'] . '" /><abbr class="longitude" title="' . $location['latitude'] . '" /></div>';
}
$output .= '</div>';
$output .= '<div class="map-link">' . location_map_link($location) . '</div>';
$output .= '</div>';
}
return $output;
}