protected function GeofieldMapLegend::getMapThemerPluginAndValues in Geofield Map 8.2
Get the MapThemer Plugin used in referenced View Style.
Parameters
string $view_id: The View Id.
string $view_display_id: The View Display Id.
Return value
array|null The MapThemer Plugin, or null.
2 calls to GeofieldMapLegend::getMapThemerPluginAndValues()
- GeofieldMapLegend::blockForm in src/
Plugin/ Block/ GeofieldMapLegend.php - GeofieldMapLegend::build in src/
Plugin/ Block/ GeofieldMapLegend.php - Builds and returns the renderable array for this block plugin.
File
- src/
Plugin/ Block/ GeofieldMapLegend.php, line 87
Class
- GeofieldMapLegend
- Provides a custom Geofield Map Legend block.
Namespace
Drupal\geofield_map\Plugin\BlockCode
protected function getMapThemerPluginAndValues($view_id, $view_display_id) {
$view_displays = $this->config
->get('views.view.' . $view_id)
->get('display');
if (!empty($view_displays) && !empty($view_displays[$view_display_id]) && isset($view_displays[$view_display_id]['display_options']['style'])) {
$view_options = $view_displays[$view_display_id]['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' && isset($view_options['map_marker_and_infowindow']['theming'][$plugin_id])) {
try {
/* @var \Drupal\geofield_map\MapThemerInterface $mapThemerPlugin */
$plugin = $this->mapThemerManager
->createInstance($plugin_id);
$theming_values = isset($view_options['map_marker_and_infowindow']['theming'][$plugin_id]['values']) ? $view_options['map_marker_and_infowindow']['theming'][$plugin_id]['values'] : NULL;
return [
$plugin,
$theming_values,
];
} catch (\Exception $e) {
watchdog_exception('Geofield Map Legend', $e);
return NULL;
}
}
}
}