Support

Account

Home Forums ACF PRO ACF Pro Address Field Replacement Reply To: ACF Pro Address Field Replacement

  • I believe it should be possible to get the below api response from google places api for an autocomplete address or from a lat/lng position pretty consistently (same principle is implemented in the Drupal Get Locations plugin). If some or all of the response is not present (e.g. a lat/lng in the ocean) the city/state/country field could be left empty. Shouldn’t this cover most use cases?

    I will see if I can make this work with Elliot’s suggestion about the google_map_change event and hidden fields. But a native solution would be much more preferable.

    “result” : {
    “address_components” : [
    {
    “long_name” : “Amsterdam”,
    “short_name” : “Amsterdam”,
    “types” : [ “locality”, “political” ]
    },
    {
    “long_name” : “Government of Amsterdam”,
    “short_name” : “Government of Amsterdam”,
    “types” : [ “administrative_area_level_2”, “political” ]
    },
    {
    “long_name” : “North Holland”,
    “short_name” : “NH”,
    “types” : [ “administrative_area_level_1”, “political” ]
    },
    {
    “long_name” : “Netherlands”,
    “short_name” : “NL”,
    “types” : [ “country”, “political” ]
    }
    ],