setAddressFieldFromGeojson should use admin level code instead of name

Created on 27 June 2023, 12 months ago
Updated 28 January 2024, 5 months ago

Steps to reproduce.
1. Add a geofield and address field types.
2. On the address field set the "Reverse Geocode from a Geofield type existing field"
3. Set the coordinates.
4. "Province/administrative area" field is set incorrectly. In the formatter it displays an area name, but in the widget, it appears as empty.

The address field property "Administrative area" field always seems to be a "select" type.
See \Drupal\address\Element\Address::processSubdivisionElements
Right now in web/modules/contrib/geocoder/src/DumperPluginManager.php:85 adminLevel Name is used as the value for the administrative area, so it sets it incorrectly because the value for a select field should be an administrative area code.

So, I'm pretty sure that code should be used instead. Didn't test it for each country, but it works for Canada and USA

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024