You are here

public function MapFeatureManager::getMapFeature in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 src/MapFeatureManager.php \Drupal\geolocation\MapFeatureManager::getMapFeature()

Return MapFeature by ID.

Parameters

string $id: MapFeature ID.

array $configuration: Configuration.

Return value

\Drupal\geolocation\MapFeatureInterface|false MapFeature instance.

File

src/MapFeatureManager.php, line 43

Class

MapFeatureManager
Search plugin manager.

Namespace

Drupal\geolocation

Code

public function getMapFeature($id, array $configuration = []) {
  if (!$this
    ->hasDefinition($id)) {
    return FALSE;
  }
  try {

    /** @var \Drupal\geolocation\MapFeatureInterface $instance */
    $instance = $this
      ->createInstance($id, $configuration);
    if ($instance) {
      return $instance;
    }
  } catch (\Exception $e) {
    return FALSE;
  }
  return FALSE;
}