public function Brazil::format in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 modules/geolocation_leaflet/src/Plugin/geolocation/GeocoderCountryFormatting/Brazil.php \Drupal\geolocation_leaflet\Plugin\geolocation\GeocoderCountryFormatting\Brazil::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/ Brazil.php, line 21
Class
- Brazil
- Provides address formatting.
Namespace
Drupal\geolocation_leaflet\Plugin\geolocation\GeocoderCountryFormattingCode
public function format(array $atomics) {
$address_elements = parent::format($atomics);
if ($atomics['state']) {
$address_elements['administrativeArea'] = $atomics['state'];
}
if ($atomics['suburb']) {
$address_elements['dependentLocality'] = $atomics['suburb'];
unset($address_elements['addressLine2']);
}
return $address_elements;
}