3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Create the map geofield behavior.

This commit is contained in:
paul121 2020-12-14 09:46:16 -08:00 committed by Michael Stenta
parent 1224aaead1
commit 0d9ec4f3b7
3 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,11 @@
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: { }

View file

@ -25,3 +25,8 @@ behavior_wkt:
dependencies:
- core/drupalSettings
- farm_map/farm_map
behavior_geofield:
js:
js/farmOS.map.behaviors.geofield.js: { }
dependencies:
- farm_map/farm_map

View file

@ -0,0 +1,13 @@
(function () {
farmOS.map.behaviors.geofield = {
attach: function (instance) {
instance.edit.wktOn('featurechange', function(wkt) {
console.log('here!');
document.querySelector('#' + instance.target).parentElement.querySelector('textarea').value = wkt;
});
},
// Make sure this runs after farmOS.map.behaviors.wkt.
weight: 101,
};
}());