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