Comments

axaios created an issue. See original summary.

christianadamski’s picture

Status: Active » Postponed (maintainer needs more info)

Could you resave your view settings and try again? Is this still happening?

fotidim’s picture

StatusFileSize
new70.09 KB

I am not entirely sure what you mean by "view settings". I tried saving my field settings, the form display settings, setting a value with lat/long and then switch back to Geocoder widget but nothing.

This is what I seeBlank Widget

I also tried creating a demo site on http://simplytest.me and I replicated it right away by adding a geolocation field to content type 'article' and setting the 'Google Geocoder' widget.

torreytoomajanian’s picture

I believe this may have been fixed in the latest 8.x-1.6 release that appears to have covered a lot of bugs. I will need to test myself when I have some time, but the root of this problem was related to lines 86 & 87 in the function geolocation.add_map() within the geolocation.js file (in the prior version). The lines in question apply the height/width CSS to the new Map:

$(map.container).css({
  height: map.settings.height,
  width: map.settings.width
});

In the new version, this is located on lines 180 & 181 within the newly named function Drupal.geolocation.addMap() which now look like this:

map.container.css({
  height: map.settings.google_map_settings.height,
  width: map.settings.google_map_settings.width
});

The .height and .width values did not exist on map.settings in the past version because they actually existed on map.settings.google_map_settings. I'm speaking off of memory from a week ago when I ran into this error, but judging by the number of changes & fixes included in the latest version update, I believe this can be marked as fixed. Will confirm when I have some free time.

fotidim’s picture

I am using 8.x-1.6 stable. I tried messing with the js file and hardcoding the values of height and width but it complains for every property of map.settings.google_map_settings. Not just height and width.

christianadamski’s picture

Title: "Cannot read property 'height' of undefined" » Geocoder Widget: "Cannot read property 'height' of undefined"
Status: Postponed (maintainer needs more info) » Active
christianadamski’s picture

Ok, the new JS test at #2769305: Add Mink/Javascript test confirms this issue as well as another one. See
https://www.drupal.org/pift-ci-job/380555

Once the test is committed, at least we will potentially notice JS errors earlier.

isholgueras’s picture

I have the same issue as @axiaos.

In the file geolocation.js:180, map.settings.google_map_settings is undefined. I'm in 8.x-1.6 version.

It seems that isn't taking the right settings from Drupal.

I will try to debug to find what happens.

christianadamski’s picture

@isholgueras,

most of the GoogleMap handling on the PHP side was moved to the GoogleMapsDisplayTrait.php

This especially includes handling the common Google Maps settings that are the same across the GoogleMap Formatter, the GeocoderWidget and the CommonMap views style.

Somewhere along that line, Geocoder isn't properly hooked up to this new functionality.

isholgueras’s picture

Yep,

I found that google_map_settings are set on that trait, but when I put a breakpoint there, it doesn't stop.

I will follow that way.

christianadamski’s picture

Status: Active » Needs review
StatusFileSize
new8.8 KB

This should do it. Besides fixing this error, it also allows the usual settings on the geocoder widget.

christianadamski’s picture

If somebody can confirm this fixing the issue, I will push it.

@derjochenmeyer: if you happen to read this: we should probably also release a new bug-fix-release once this is taken care of.

Status: Needs review » Needs work

The last submitted patch, 11: 2768813-11-hook_up_geocoder_to_goole_map_trait.patch, failed testing.

The last submitted patch, 11: 2768813-11-hook_up_geocoder_to_goole_map_trait.patch, failed testing.

The last submitted patch, 11: 2768813-11-hook_up_geocoder_to_goole_map_trait.patch, failed testing.

christianadamski’s picture

Status: Needs work » Needs review
StatusFileSize
new9.96 KB

Added schema definitions. This is non-ideal currently, but I don't know how to avoid repeating those settings over and over in schema.

Status: Needs review » Needs work

The last submitted patch, 16: 2768813-16-hook_up_geocoder_to_goole_map_trait.patch, failed testing.

The last submitted patch, 16: 2768813-16-hook_up_geocoder_to_goole_map_trait.patch, failed testing.

The last submitted patch, 16: 2768813-16-hook_up_geocoder_to_goole_map_trait.patch, failed testing.

christianadamski’s picture

Status: Needs work » Needs review
StatusFileSize
new14.27 KB

More schema fixes

derjochenmeyer’s picture

Issue summary: View changes
StatusFileSize
new77.11 KB
new93.18 KB

I applied the latest patch on simplytest.me. No console errors. Screens look good, works like a charm.

Node edit:

Node view:

I agree, lets put this in a 8.x-1.7 release.

derjochenmeyer’s picture

Issue summary: View changes

  • ChristianAdamski authored 3e38d25 on 8.x-1.x
    Issue #2768813 by ChristianAdamski, axaios: Geocoder Widget: "Cannot...
christianadamski’s picture

Status: Needs review » Fixed
isholgueras’s picture

Yes, The patch applies right and now it works perfect.

Thanks

fotidim’s picture

I am getting some weird errors with 8.x-1.7. The map tries to load momentarily and then I get this:
error

and on the console:
console

christianadamski’s picture

@axaios

as of late, you do need a valid Google API key to use Google Maps. So that second "Missing Key" error is okay and expected. Follow the link mentioned in the error and follow the steps. You can add the API key later to gelocation at /admin/config/services/geolocation

That autocomplete one is more interesting. But will probably be resolved, once the map actually loads, so the search elements can be attached.

fotidim’s picture

@ChristianAdamski

You were right. Perhaps you can improve it by showing a message to the user if the API key is not set and not try to load the map at all.

Many thanks for the great module!

fotidim’s picture

Maybe I rushed a bit. After adding the API key the map load but the console still shows "$(...).children(...).first(...).autocomplete is not a function". And the problem is that autocomplete actually does not work. When I type something in the search field no suggestions show up and pressing enter reloads the whole page. I also tried testing it on simplytest.me and there it works. Any suggestions?

fotidim’s picture

I have narrowed down the issue. Please see here: https://www.drupal.org/node/2770143

huzooka’s picture

The pushed patch contains schema change without any schema update hook.

Status: Fixed » Closed (fixed)

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