You are here

public function Germany::format in Geolocation Field 8.3

Same name in this branch
  1. 8.3 modules/geolocation_google_maps/src/Plugin/geolocation/GeocoderCountryFormatting/Germany.php \Drupal\geolocation_google_maps\Plugin\geolocation\GeocoderCountryFormatting\Germany::format()
  2. 8.3 modules/geolocation_leaflet/src/Plugin/geolocation/GeocoderCountryFormatting/Germany.php \Drupal\geolocation_leaflet\Plugin\geolocation\GeocoderCountryFormatting\Germany::format()

Reverse geocode an address.

Intended return subject to available data:

[
  'organization',
  'address_line1',
  'address_line2',
  'postal_code',
  'sorting_code',
  'dependent_locality',
  'dependent_locality_code',
  'locality',
  'locality_code',
  'administrative_area',
  'administrative_area_code',
  'country',
  'country_code',
  'formatted_address',
];

Parameters

array $atomics: Address components.

Return value

array||null Address or NULL.

Overrides NominatimRoadFirstFormattingBase::format

File

modules/geolocation_leaflet/src/Plugin/geolocation/GeocoderCountryFormatting/Germany.php, line 21

Class

Germany
Provides address formatting.

Namespace

Drupal\geolocation_leaflet\Plugin\geolocation\GeocoderCountryFormatting

Code

public function format(array $atomics) {
  $address_elements = parent::format($atomics);
  if (empty($address_elements['locality']) && !empty($atomics['state'])) {
    $address_elements['locality'] = $atomics['state'];
  }
  return $address_elements;
}