I stand on the following tricky situation:
I have a node with geofield coordinates attached. I am constructing an array of points. Something like:
Array
(
[86] => Array
(
[0] => Array
(
[lat] => 39.1641410477
[lon] => -2.633972168
)
[1] => Array
(
[lat] => 41.0420738489
[lon] => -2.633972168
)
[2] => Array
(
[lat] => 41.0420738489
[lon] => 1.2524414063
)
[3] => Array
(
[lat] => 39.1641410477
[lon] => 1.2524414063
)
[4] => Array
(
[lat] => 39.1641410477
[lon] => -2.633972168
)
)
[85] => Array
(
[0] => Array
(
[lat] => 39.1641410477
[lon] => -2.633972168
)
[1] => Array
(
[lat] => 41.0420738489
[lon] => -2.633972168
)
[2] => Array
(
[lat] => 41.0420738489
[lon] => 1.2524414063
)
[3] => Array
(
[lat] => 39.1641410477
[lon] => 1.2524414063
)
[4] => Array
(
[lat] => 39.1641410477
[lon] => -2.633972168
)
)
)
I want to pass this to my-googlemaps.js in order to be used by google's init map Google map is defined as:
my-map:
header: true
js:
js/my-googlemaps.js: { }
https://maps.googleapis.com/maps/api/js?key=my_key&callback=initMap: {type: external, attributes: {defer: true,async: true}}
dependencies:
- core/drupal
- core/drupalSettings
my-googlemaps.js:
console.log(Drupal.settings);
function initMap() {}
This way I get Drupal.settings undefined, which makes sense I guess. On the other hanve if I place initMap into a behavior It can not be seen as a callback as defined in googleapis.com before.
Has anyone stumbled with this before? Any idea how to attack the problem?