public function GeocoderManager::getGeocoder in Geolocation Field 8
Same name and namespace in other branches
- 8.3 src/GeocoderManager.php \Drupal\geolocation\GeocoderManager::getGeocoder()
- 8.2 src/GeocoderManager.php \Drupal\geolocation\GeocoderManager::getGeocoder()
Return Geocoder by ID.
Parameters
string $id: Geocoder ID.
array $configuration: Configuration.
Return value
\Drupal\geolocation\GeocoderInterface|false Geocoder instance.
File
- src/
GeocoderManager.php, line 43
Class
- GeocoderManager
- Search plugin manager.
Namespace
Drupal\geolocationCode
public function getGeocoder($id, array $configuration = []) {
$definitions = $this
->getDefinitions();
if (empty($definitions[$id])) {
return FALSE;
}
try {
/** @var \Drupal\geolocation\GeocoderInterface $instance */
$instance = $this
->createInstance($id, $configuration);
if ($instance) {
return $instance;
}
} catch (\Exception $e) {
return FALSE;
}
return FALSE;
}