public function GeocoderApiEnpoints::geocode in Geocoder 8.2
Same name and namespace in other branches
- 8.3 src/Controller/GeocoderApiEnpoints.php \Drupal\geocoder\Controller\GeocoderApiEnpoints::geocode()
1 string reference to 'GeocoderApiEnpoints::geocode'
File
- src/
Controller/ GeocoderApiEnpoints.php, line 227
Class
- GeocoderApiEnpoints
- Class GeocoderApiEnpoints.
Namespace
Drupal\geocoder\ControllerCode
public function geocode(Request $request) {
$address = $request
->get('address');
$geocoders_ids = $request
->get('geocoder');
$geocoders = explode(',', str_replace(' ', '', $geocoders_ids));
$format = $request
->get('format');
$address_format = $request
->get('address_format');
if (isset($address)) {
$options = $this
->setGeocodersOptions($request);
$dumper = $this
->getDumper($format);
$geo_collection = $this->geocoder
->geocode($address, $geocoders, $options);
if ($geo_collection && $geo_collection instanceof AddressCollection) {
$this
->getAddressCollectionResponse($geo_collection, $dumper, $address_format);
}
}
return $this->response;
}