'center', 'data' => '
'. t('Country') .'
'), array('align' => 'center', 'data' => '
'. t('Options') .'
')); $rows = array(); foreach (element_children($form['countries']) as $country_iso) { $row = array(); $row[] = array( 'data' => drupal_render($form['countries'][$country_iso]['label_'. $country_iso]) ); $row[] = array( 'data' => drupal_render($form['countries'][$country_iso]['location_map_link_'. $country_iso]) ); $rows[] = $row; } $output = theme('table', $header, $rows); foreach (element_children($form) as $key) { $output .= drupal_render($form[$key]); } $output .= drupal_render($form); return $output; } function theme_location_geocoding_options(&$form) { $header = array( array('align' => 'center', 'data' => '
'. t('Country') .'
'), array('align' => 'center', 'data' => '
'. t('Options') .'
'), array('align' => 'center', 'data' => '
'. t('Configure') .'
') ); $rows = array(); foreach (element_children($form['countries']) as $country_iso) { $row = array(); $row[] = array( 'data' => drupal_render($form['countries'][$country_iso]['label_'. $country_iso]) ); $row[] = array( 'data' => drupal_render($form['countries'][$country_iso]['location_geocode_'. $country_iso]) ); $row[] = array( 'data' => drupal_render($form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso]) ); $rows[] = $row; } $output = theme('table', $header, $rows); foreach (element_children($form) as $key) { $output .= drupal_render($form[$key]); } $output .= drupal_render($form); return $output; } /** * Generates HTML for the ALL passed locations. * * @param $location * Array. A series of locations with the following fields: * '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 * @param $hide * Array. The values are the location fields to suppress in the themed display. * @ingroup themeable */ function theme_locations($locations = array(), $hide = array()) { $output = ''; if (count($locations)) { $output .= '

'. (count($locations) > 1 ? t('Locations') : t('Location')) .'

'; foreach ($locations as $location) { $output .= theme('location', $location, $hide); } } return $output; } // @@@ All this in_array is really stupid. /** * Generates HTML for the passed location. * * @param $location * Array. A single location with the following fields: * '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 * @param $hide * Array. The values are the location fields to suppress in the themed display. * @ingroup themeable */ function theme_location($location = array(), $hide = array()) { // Check if it have at least one field to be displayed. array_flip($hide); foreach (array('street', 'city', 'province', 'postal_code', 'country', 'latitude', 'longitude') as $field) { if (!empty($location[$field]) && empty($hide[$field])) { $display = TRUE; break; } } if (empty($display)) { 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 .= '
'."\n"; if (!empty($location['name']) && !in_array('name', $hide)) { $output .= theme('placeholder', $location['name']); } if (!empty($location['street']) && !in_array('street', $hide)) { $output .= '
'. $location['street']; if (!empty($location['additional']) && !in_array('additional', $hide)) { $output .= ' '. $location['additional']; } $output .='
'; } if (!empty($location['city']) && !in_array('city', $hide)) { $city_province_postal[] = $location['city']; } if ((!empty($location['city']) && !in_array('city', $hide)) || (!empty($location['province']) && !in_array('province', $hide)) || (!empty($location['postal_code']) && !in_array('postal_code', $hide))) { $city_province_postal = array(); if (!empty($location['city']) && !in_array('city', $hide)) { $city_province_postal[] = ''. $location['city'] .''; } if (!empty($location['province']) && !in_array('province', $hide)) { $city_province_postal[] = ''. $location['province'] .''; } if (!empty($location['postal_code']) && !in_array('postal_code', $hide)) { $city_province_postal[] = ''. $location['postal_code'] .''; } $output .= implode(', ', $city_province_postal); } if (!empty($location['country_name']) && !in_array('country', $hide)) { $output .= '
'. $location['country_name'] .'
'; } if (isset($location['latitude']) && isset($location['longitude']) && !in_array('latitude', $hide) && !in_array('longitude', $hide)) { // "Geo" microformat, see http://microformats.org/wiki/geo $output .= ''. theme('location_latitude_dms', $location['latitude']) .', '. theme('location_longitude_dms', $location['longitude']) .''; } $output .= '
'; } if (!in_array('map_link', $hide)) { $output .= location_map_link($location); } return $output; }