public function DataProviderManager::getDataProviderByViewsField in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 src/DataProviderManager.php \Drupal\geolocation\DataProviderManager::getDataProviderByViewsField()
Return DataProvider by field type.
Parameters
\Drupal\views\Plugin\views\field\FieldPluginBase $viewField: Map type.
array $configuration: Configuration.
Return value
\Drupal\geolocation\DataProviderInterface|false Data provider.
File
- src/
DataProviderManager.php, line 46
Class
- DataProviderManager
- Search plugin manager.
Namespace
Drupal\geolocationCode
public function getDataProviderByViewsField(FieldPluginBase $viewField, array $configuration = []) {
$definitions = $this
->getDefinitions();
try {
foreach ($definitions as $dataProviderId => $dataProviderDefinition) {
/** @var \Drupal\geolocation\DataProviderInterface $dataProvider */
$dataProvider = $this
->createInstance($dataProviderId, $configuration);
if ($dataProvider
->isViewsGeoOption($viewField)) {
$dataProvider
->setViewsField($viewField);
return $dataProvider;
}
}
} catch (\Exception $e) {
return FALSE;
}
return FALSE;
}