public function GeocoderFieldPluginManager::getPluginByFieldType in Geocoder 8.2
Same name and namespace in other branches
- 8.3 modules/geocoder_field/src/GeocoderFieldPluginManager.php \Drupal\geocoder_field\GeocoderFieldPluginManager::getPluginByFieldType()
Returns the first plugin that handles a specific field type.
Parameters
string $field_type: The type of field for which to find a plugin.
Return value
\Drupal\geocoder_field\GeocoderFieldPluginInterface|null The plugin instance or NULL, if no plugin handles this field type.
File
- modules/
geocoder_field/ src/ GeocoderFieldPluginManager.php, line 104
Class
- GeocoderFieldPluginManager
- The Geocoder Field Plugin manager.
Namespace
Drupal\geocoder_fieldCode
public function getPluginByFieldType($field_type) {
foreach ($this
->getDefinitions() as $definition) {
if (in_array($field_type, $definition['field_types'])) {
/* @var \Drupal\geocoder_field\GeocoderFieldPluginInterface $geocoder_field_plugin */
$geocoder_field_plugin = $this
->createInstance($definition['id']);
return $geocoder_field_plugin;
}
}
return NULL;
}