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:
parent
1224aaead1
commit
0d9ec4f3b7
|
@ -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: { }
|
|
@ -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
|
||||
|
|
13
modules/core/map/js/farmOS.map.behaviors.geofield.js
Normal file
13
modules/core/map/js/farmOS.map.behaviors.geofield.js
Normal 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,
|
||||
};
|
||||
}());
|
Loading…
Reference in a new issue