Update geocode_address.js: Remove jQuery.once() and use leaflet GeoJson Data field to update location on map

Created on 1 July 2024, 6 months ago

Problem/Motivation

The geocode_address.js file still uses once() incorrectly
see here

It also tries to add the resulted lon/lat to a lon/lat field in the map, which does not seem to exist. Instead we save them in the Geojson Data field in the leaflet field

The Field widget uses the method $val->getFormattedAddress(); , which does not exist
we are now using $val->getDisplayName();

Steps to reproduce

Drupal =>10.2.6
address_js_gocoder => 2.0.x-dev
Address => ^2.0
leaflet=> ^10.2
Setup as explained in the module page
Try to resolve an address
Notice the js error in the console
TypeError: $(...).once is not a function

Proposed resolution

For our usecase :
Remove jquery.once and use the button click event to resolve the address
Replace getFormattedAddress with get getDisplayName in the widget
Save the data in the Geojson data field

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium Orabi Gent

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024