You are here

function geocoder_widget_parse_locationfield in Geocoder 7

Geocoder Widget - Parse a location field.

8 calls to geocoder_widget_parse_locationfield()
geocoder_bing_field in plugins/geocoder_handler/bing.inc
Plugin callback.
geocoder_google_field in plugins/geocoder_handler/google.inc
Plugin callback.
geocoder_mapbox_field in plugins/geocoder_handler/mapbox.inc
Plugin callback.
geocoder_mapquest_nominatim_field in plugins/geocoder_handler/mapquest_nominatim.inc
Plugin callback.
geocoder_mapzen_field in plugins/geocoder_handler/mapzen.inc
Plugin callback.

... See full list

File

./geocoder.widget.inc, line 668
geocoder.widget.inc

Code

function geocoder_widget_parse_locationfield($field_item) {
  $address = '';
  if (!empty($field_item['street'])) {
    $address .= $field_item['street'] . ',';
  }
  if (!empty($field_item['additional'])) {
    $address .= $field_item['additional'] . ',';
  }
  if (!empty($field_item['city'])) {
    $address .= $field_item['city'] . ',';
  }
  if (!empty($field_item['postal_code'])) {
    $address .= $field_item['postal_code'] . ',';
  }
  if (!empty($field_item['province']) && function_exists('location_province_name')) {
    $province_fullname = location_province_name($field_item['country'], $field_item['province']);
    $address .= $province_fullname . ',';
  }
  if (!empty($field_item['country'])) {
    $address .= $field_item['country'] . ',';
  }
  $address = rtrim($address, ', ');
  return $address;
}