diff --git a/modules/core/map/src/Element/FarmMap.php b/modules/core/map/src/Element/FarmMap.php index 7f2b795fa..d4321a620 100644 --- a/modules/core/map/src/Element/FarmMap.php +++ b/modules/core/map/src/Element/FarmMap.php @@ -24,6 +24,7 @@ class FarmMap extends RenderElement { ], '#theme' => 'farm_map', '#map_type' => 'default', + '#map_settings' => [], ]; } @@ -66,14 +67,11 @@ class FarmMap extends RenderElement { $element['#attached']['library'][] = 'farm_map/farmOS-map'; $element['#attached']['library'][] = 'farm_map/farm_map'; - // Include map settings. - $map_settings = !empty($element['#map_settings']) ? $element['#map_settings'] : []; - // Include the map options. $map_options = $map->getMapOptions(); // Add the instance settings under the map id key. - $instance_settings = array_merge_recursive($map_settings, $map_options); + $instance_settings = array_merge_recursive($element['#map_settings'], $map_options); $element['#attached']['drupalSettings']['farm_map'][$map_id] = $instance_settings; // Create and dispatch a MapRenderEvent. diff --git a/modules/core/map/src/Element/FarmMapInput.php b/modules/core/map/src/Element/FarmMapInput.php index 2f12e4a09..0ce685a37 100644 --- a/modules/core/map/src/Element/FarmMapInput.php +++ b/modules/core/map/src/Element/FarmMapInput.php @@ -35,6 +35,7 @@ class FarmMapInput extends FormElement { // Display descriptions above the map by default. '#description_display' => 'before', '#map_type' => 'geofield_widget', + '#map_settings' => [], '#default_value' => '', '#display_raw_geometry' => TRUE, ];