class Geofield in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 modules/geolocation_geofield/src/Plugin/geolocation/DataProvider/Geofield.php \Drupal\geolocation_geofield\Plugin\geolocation\DataProvider\Geofield
Provides Google Maps.
Plugin annotation
@DataProvider(
id = "geofield",
name = @Translation("Geofield"),
description = @Translation("Geofield."),
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\geolocation\DataProviderBase implements ContainerFactoryPluginInterface, DataProviderInterface
- class \Drupal\geolocation_geofield\Plugin\geolocation\DataProvider\Geofield implements DataProviderInterface
- class \Drupal\geolocation\DataProviderBase implements ContainerFactoryPluginInterface, DataProviderInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of Geofield
1 string reference to 'Geofield'
- geolocation_geofield.data_provider.schema.yml in modules/
geolocation_geofield/ config/ schema/ geolocation_geofield.data_provider.schema.yml - modules/geolocation_geofield/config/schema/geolocation_geofield.data_provider.schema.yml
File
- modules/
geolocation_geofield/ src/ Plugin/ geolocation/ DataProvider/ Geofield.php, line 22
Namespace
Drupal\geolocation_geofield\Plugin\geolocation\DataProviderView source
class Geofield extends DataProviderBase implements DataProviderInterface {
/**
* {@inheritdoc}
*/
public function isViewsGeoOption(FieldPluginBase $views_field) {
if ($views_field instanceof EntityField && $views_field
->getPluginId() == 'field') {
$field_storage_definitions = $this->entityFieldManager
->getFieldStorageDefinitions($views_field
->getEntityType());
if (!empty($field_storage_definitions[$views_field->field])) {
$field_storage_definition = $field_storage_definitions[$views_field->field];
if ($field_storage_definition
->getType() == 'geofield') {
return TRUE;
}
}
}
return FALSE;
}
/**
* {@inheritdoc}
*/
public function isFieldGeoOption(FieldDefinitionInterface $fieldDefinition) {
return $fieldDefinition
->getType() == 'geofield';
}
/**
* {@inheritdoc}
*/
public function getPositionsFromItem(FieldItemInterface $fieldItem) {
if ($fieldItem instanceof GeofieldItem) {
return [
'lat' => $fieldItem
->get('lat')
->getValue(),
'lng' => $fieldItem
->get('lon')
->getValue(),
];
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DataProviderBase:: |
protected | property | Entity field manager. | |
DataProviderBase:: |
protected | property | Field definition. | |
DataProviderBase:: |
protected | property | Views field. | |
DataProviderBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
1 |
DataProviderBase:: |
public | function | Token replacement support function, callback to token replacement function. | |
DataProviderBase:: |
public | function |
Get positions from views row. Overrides DataProviderInterface:: |
1 |
DataProviderBase:: |
public | function |
Provide data provider settings form array. Overrides DataProviderInterface:: |
1 |
DataProviderBase:: |
public | function |
Return field item tokens. Overrides DataProviderInterface:: |
1 |
DataProviderBase:: |
public | function |
Replace field item tokens. Overrides DataProviderInterface:: |
1 |
DataProviderBase:: |
public | function |
Set field definition. Overrides DataProviderInterface:: |
|
DataProviderBase:: |
public | function |
Set views field. Overrides DataProviderInterface:: |
|
DataProviderBase:: |
public | function |
Constructs a new GeocoderBase object. Overrides PluginBase:: |
1 |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
Geofield:: |
public | function |
Get positions from field item list. Overrides DataProviderBase:: |
|
Geofield:: |
public | function |
Determine valid field geo option. Overrides DataProviderInterface:: |
|
Geofield:: |
public | function |
Determine valid views option. Overrides DataProviderBase:: |
|
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |