diff --git a/config/schema/leaflet.schema.yml b/config/schema/leaflet.schema.yml index 880c90fce8048a80b5b2fd80d77cbab9e958d9ef..3b1395ed49577be0f438f566d26415a7c75f3a94 100644 --- a/config/schema/leaflet.schema.yml +++ b/config/schema/leaflet.schema.yml @@ -115,9 +115,9 @@ field.widget.settings.leaflet_widget_default: options: type: text label: 'Options' - locate: + fullscreen: type: mapping - label: 'Locate User Position' + label: 'Leaflet Fullscreen' mapping: control: type: boolean @@ -125,12 +125,12 @@ field.widget.settings.leaflet_widget_default: options: type: text label: 'Options' - automatic: - type: boolean - label: 'Automatically locate user current position' - fullscreen: + path: + type: text + label: 'Path' + locate: type: mapping - label: 'Leaflet Fullscreen' + label: 'Locate User Position' mapping: control: type: boolean @@ -138,10 +138,9 @@ field.widget.settings.leaflet_widget_default: options: type: text label: 'Options' - - path: - type: text - label: 'Path' + automatic: + type: boolean + label: 'Automatically locate user current position' geocoder: type: mapping label: 'Gecoder map control' diff --git a/src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php b/src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php index 1a715257c5433379b50cd60e1daeff1752e0cb0f..1dfc65320950fd894d764baee21badd64933200d 100644 --- a/src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php +++ b/src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php @@ -169,7 +169,7 @@ class LeafletDefaultWidget extends GeofieldDefaultWidget { public static function defaultSettings() { $base_layers = self::getLeafletMaps(); - $options = array_merge(parent::defaultSettings(), [ + return array_merge(parent::defaultSettings(), [ 'map' => [ 'leaflet_map' => array_shift($base_layers), 'height' => 400, @@ -195,12 +195,37 @@ class LeafletDefaultWidget extends GeofieldDefaultWidget { 'removalMode' => TRUE, 'rotateMode' => FALSE, ], + 'reset_map' => [ + 'control' => FALSE, + 'options' => '{"position": "topleft", "title": "Reset View"}', + ], + 'fullscreen' => [ + 'control' => FALSE, + 'options' => '{"position":"topleft","pseudoFullscreen":false}', + ], + 'path' => '{"color":"#3388ff","opacity":"1.0","stroke":true,"weight":3,"fill":"depends","fillColor":"*","fillOpacity":"0.2","radius":"6"}', + 'feature_properties' => [ + 'values' => '', + ], + 'locate' => [ + 'control' => FALSE, + 'options' => '{"position": "topright", "setView": "untilPanOrZoom", "returnToPrevBounds":true, "keepCurrentZoomLevel": true, "strings": {"title": "Locate my position"}}', + 'automatic' => FALSE, + ], + 'geocoder' => [ + 'control' => FALSE, + 'settings' => [ + 'position' => 'topright', + 'input_size' => 20, + 'providers' => [], + 'min_terms' => 4, + 'delay' => 800, + 'zoom' => 16, + 'popup' => FALSE, + 'options' => '', + ], + ], ]); - $leaflet_map_default_settings = []; - foreach (self::getDefaultSettings() as $k => $setting) { - $leaflet_map_default_settings[$k] = $setting; - } - return $options + $leaflet_map_default_settings; } /**