The push from the Google geocoder widget to an Address field is broken since a recent change in the Address module (#2689089: Define a form element type "address").

Additionally I found a second bug related to the explicite_actions_address_field. In the module schema the field is defined as a string, and this causes the following comparison to fail in geolocation-widget-googlegeocoder.js becaue the string '0' is not equivalent to false.

if (!drupalSettings.geolocation.widgetSettings[map.id].addressFieldExpliciteActions) {
  Drupal.geolocation.geocoderWidget.setHiddenAddressFieldByReverseLocation(location, map);
}

I've rolled a patch that fixes both issues.

Comments

Peacog created an issue. See original summary.

peacog’s picture

Status: Active » Needs review
StatusFileSize
new1.23 KB

Here's the patch.

christianadamski’s picture

Priority: Normal » Major
juliencarnot’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch, it solves the regression. Marking RTBC.

rakesh.nimje84@gmail.com’s picture

Yes. The patch is working.
Thanks for patch.

thedut’s picture

Hello,
I confirm the path solves this issue for me.
FYI , on my drupal 8 site, only the second part of the patch was enought :

-        if (settings.extraData._drupal_ajax && settings.extraData._triggering_element_name === targetField + '[0][country_code]') {
+        if (settings.extraData._drupal_ajax && settings.extraData._triggering_element_name === targetField + '[0][address][country_code]') {
flodevelop’s picture

Hello,

I think you need to reinstall the module to apply the update of the explicite_actions_address_field schema.

If you've already build views you could potentially lose it ?

Maybe a hook update table would be useful for those who are going to update this module in the next version.

Or you could add a parseInt in the js condition :

if (!parseInt(drupalSettings.geolocation.widgetSettings[map.id].addressFieldExpliciteActions)) {
  Drupal.geolocation.geocoderWidget.setHiddenAddressField(ui.item.address, map);
}

Best

christianadamski’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.13 KB

Removed the schema change, added some code fixes.

christianadamski’s picture

Status: Needs review » Fixed
thedut’s picture

Thanks for the information on #7, I'm going to reinstall the geolocation module.

christianadamski’s picture

@thedut,

I did not commit the schema change, so you do not have to reinstall with current -dev

adamspe’s picture

This patch did not work for me. The jQuery find of ('.details-wrapper') after AJAX replacement fails to find anything (relies on how address formats its widget).

I manually updated it (temporarily) like:

      $(document).ajaxComplete(function (event, xhr, settings) {
        // Update after AJAX replacement.
        /*addressDetails = addressField.find('.details-wrapper').first();

        if (addressDetails.length < 1) {
          return;
        }*/
        addressDetails = addressField;
...

And then it works (simply using the original addressField element to find the nested input elements for the address parts).

I can't say if this is entirely appropriate but my address field does NOT contain a nested element with the class details-wrapper on it and cannot find that string anywhere within its source.

The version of the address module I have installed is the current latest, 8.x-1.0-rc4

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

florin_simion’s picture

Component: Google Maps geolocation » Geolocation Field / Backend

The push option is working well on a content type but Is not when I try to use it with commerce for the address field. Customizable at this path admin/config/people/profiles/manage/customer/fields

Geolocation 8.x-1.11
Drupal 8.5.5