protected function GeofieldMapLegend::getGeofieldMapLegends in Geofield Map 8.2
Get elegible Geofield Map legends.
Find of Geofield Map Views Styles where a theming has been defined and outputs them in the form of view_id:view_display_id array list.
Return value
array The legends list.
1 call to GeofieldMapLegend::getGeofieldMapLegends()
- GeofieldMapLegend::blockForm in src/
Plugin/ Block/ GeofieldMapLegend.php
File
- src/
Plugin/ Block/ GeofieldMapLegend.php, line 386
Class
- GeofieldMapLegend
- Provides a custom Geofield Map Legend block.
Namespace
Drupal\geofield_map\Plugin\BlockCode
protected function getGeofieldMapLegends() {
$geofield_legends = [];
$enabled_views = Views::getEnabledViews();
/* @var \Drupal\views\Entity\View $view */
foreach ($enabled_views as $view_id => $view) {
foreach ($this->config
->get('views.view.' . $view_id)
->get('display') as $id => $view_display) {
if (isset($view_display['display_options']['style']) && $view_display['display_options']['style']['type'] == 'geofield_google_map') {
$view_options = $view_display['display_options']['style']['options'];
$plugin_id = isset($view_options['map_marker_and_infowindow']['theming']) ? $view_options['map_marker_and_infowindow']['theming']['plugin_id'] : NULL;
if (isset($plugin_id) && $plugin_id != 'none') {
$geofield_legends[$view_id . ':' . $id] = $view
->label() . ' - display: ' . $id;
}
}
}
}
return $geofield_legends;
}