diff --git a/modules/core/map/config/install/farm_map.map_behavior.geofield.yml b/modules/core/map/config/install/farm_map.map_behavior.geofield.yml deleted file mode 100644 index f4f0897ca..000000000 --- a/modules/core/map/config/install/farm_map.map_behavior.geofield.yml +++ /dev/null @@ -1,11 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_map -id: geofield -label: Geofield -description: 'Copies map layer data into a form textarea.' -library: 'farm_map/behavior_geofield' -settings: { } diff --git a/modules/core/map/config/install/farm_map.map_behavior.input.yml b/modules/core/map/config/install/farm_map.map_behavior.input.yml new file mode 100644 index 000000000..df1acdd0b --- /dev/null +++ b/modules/core/map/config/install/farm_map.map_behavior.input.yml @@ -0,0 +1,11 @@ +langcode: en +status: true +dependencies: + enforced: + module: + - farm_map +id: input +label: Input +description: 'Syncs editable map layer data into a form input.' +library: 'farm_map/behavior_input' +settings: { } diff --git a/modules/core/map/farm_map.libraries.yml b/modules/core/map/farm_map.libraries.yml index f286062c4..50db0321e 100644 --- a/modules/core/map/farm_map.libraries.yml +++ b/modules/core/map/farm_map.libraries.yml @@ -30,9 +30,9 @@ behavior_wkt: dependencies: - core/drupalSettings - farm_map/farm_map -behavior_geofield: +behavior_input: js: - js/farmOS.map.behaviors.geofield.js: { } + js/farmOS.map.behaviors.input.js: { } dependencies: - farm_map/farm_map behavior_enable_side_panel: diff --git a/modules/core/map/farm_map.post_update.php b/modules/core/map/farm_map.post_update.php new file mode 100644 index 000000000..4d66458a7 --- /dev/null +++ b/modules/core/map/farm_map.post_update.php @@ -0,0 +1,35 @@ + 'input', + 'label' => 'Input', + 'description' => 'Syncs editable map layer data into a form input.', + 'library' => 'farm_map/behavior_input', + 'settings' => [], + 'dependencies' => [ + 'enforced' => [ + 'module' => [ + 'farm_map', + ], + ], + ], + ]); + $input_behavior->save(); + + // Delete the geofield behavior. + $geofield_behavior = MapBehavior::load('geofield'); + $geofield_behavior->delete(); +} diff --git a/modules/core/map/js/farmOS.map.behaviors.geofield.js b/modules/core/map/js/farmOS.map.behaviors.input.js similarity index 91% rename from modules/core/map/js/farmOS.map.behaviors.geofield.js rename to modules/core/map/js/farmOS.map.behaviors.input.js index 6b4b1665a..127de36e1 100644 --- a/modules/core/map/js/farmOS.map.behaviors.geofield.js +++ b/modules/core/map/js/farmOS.map.behaviors.input.js @@ -1,5 +1,5 @@ (function () { - farmOS.map.behaviors.geofield = { + farmOS.map.behaviors.input = { attach: function (instance) { instance.editAttached.then(() => { instance.edit.wktOn('featurechange', function(wkt) { diff --git a/modules/core/map/src/EventSubscriber/MapRenderEventSubscriber.php b/modules/core/map/src/EventSubscriber/MapRenderEventSubscriber.php index 71ef0de42..053cbab6c 100644 --- a/modules/core/map/src/EventSubscriber/MapRenderEventSubscriber.php +++ b/modules/core/map/src/EventSubscriber/MapRenderEventSubscriber.php @@ -61,10 +61,10 @@ class MapRenderEventSubscriber implements EventSubscriberInterface { $event->addBehavior('wkt'); } - // Add the wkt and geofield behavior to the geofield_widget map. + // Add the wkt and input behavior to the geofield_widget map. if (in_array($event->getMapType()->id(), ['geofield_widget'])) { $event->addBehavior('wkt'); - $event->addBehavior('geofield'); + $event->addBehavior('input'); } // Get whether the side panel should be enabled.