protected function GeofieldGoogleMapViewStyle::getAvailableDataSources in Geofield Map 8.2
Get a list of fields and a sublist of geo data fields in this view.
Return value
array Available data sources.
1 call to GeofieldGoogleMapViewStyle::getAvailableDataSources()
- GeofieldGoogleMapViewStyle::buildOptionsForm in src/
Plugin/ views/ style/ GeofieldGoogleMapViewStyle.php - Provide a form to edit options for this plugin.
File
- src/
Plugin/ views/ style/ GeofieldGoogleMapViewStyle.php, line 390
Class
- GeofieldGoogleMapViewStyle
- Style plugin to render a View output as a Leaflet map.
Namespace
Drupal\geofield_map\Plugin\views\styleCode
protected function getAvailableDataSources() {
$fields_geo_data = [];
/* @var \Drupal\views\Plugin\views\ViewsHandlerInterface $handler) */
foreach ($this->displayHandler
->getHandlers('field') as $field_id => $handler) {
$label = $handler
->adminLabel() ?: $field_id;
$this->viewFields[$field_id] = $label;
if (is_a($handler, '\\Drupal\\views\\Plugin\\views\\field\\EntityField')) {
/* @var \Drupal\views\Plugin\views\field\EntityField $handler */
try {
$entity_type = $handler
->getEntityType();
} catch (\Exception $e) {
$entity_type = NULL;
}
$field_storage_definitions = $this->entityFieldManager
->getFieldStorageDefinitions($entity_type);
$field_storage_definition = $field_storage_definitions[$handler->definition['field_name']];
$type = $field_storage_definition
->getType();
$definition = $this->fieldTypeManager
->getDefinition($type);
if (is_a($definition['class'], '\\Drupal\\geofield\\Plugin\\Field\\FieldType\\GeofieldItem', TRUE)) {
$fields_geo_data[$field_id] = $label;
}
}
}
return $fields_geo_data;
}