public function LeafletMarkerPopup::alterMap in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletMarkerPopup.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature\LeafletMarkerPopup::alterMap()
Alter render array.
Parameters
array $render_array: Render array.
array $feature_settings: The current feature settings.
array $context: Context like field formatter, field widget or view.
Return value
array Render array.
Overrides MapFeatureBase::alterMap
File
- modules/
geolocation_leaflet/ src/ Plugin/ geolocation/ MapFeature/ LeafletMarkerPopup.php, line 108
Class
- LeafletMarkerPopup
- Provides marker popup.
Namespace
Drupal\geolocation_leaflet\Plugin\geolocation\MapFeatureCode
public function alterMap(array $render_array, array $feature_settings, array $context = []) {
$render_array = parent::alterMap($render_array, $feature_settings, $context);
$render_array['#attached'] = BubbleableMetadata::mergeAttachments(empty($render_array['#attached']) ? [] : $render_array['#attached'], [
'library' => [
'geolocation_leaflet/mapfeature.' . $this
->getPluginId(),
],
'drupalSettings' => [
'geolocation' => [
'maps' => [
$render_array['#id'] => [
$this
->getPluginId() => [
'enable' => TRUE,
'infoAutoDisplay' => $feature_settings['info_auto_display'],
'maxWidth' => $feature_settings['max_width'],
'minWidth' => $feature_settings['min_width'],
'maxHeight' => $feature_settings['max_height'],
'autoPan' => $feature_settings['auto_pan'],
'keepInView' => $feature_settings['keep_in_view'],
'closeButton' => $feature_settings['close_button'],
'autoClose' => $feature_settings['auto_close'],
'closeOnEscapeKey' => $feature_settings['close_on_escape_key'],
'className' => $feature_settings['class_name'],
],
],
],
],
],
]);
return $render_array;
}