When the field is used inside of a closed Paragraph (https://www.drupal.org/project/paragraphs), the map isn't being rendered when creating a new or editing an existing Paragraph.

Steps to reproduce:
1. Download and install both Paragraphs (https://www.drupal.org/project/paragraphs) and Geolocation.
2. Create a new paragraph bundle and add a geolocation field to it (use any of the google maps widgets).
3. Add a paragraphs field to any content type and activate the bundle we created in step 2.
4. Create new page and add a new paragraph.

Expected result:
New Paragraph appears with Google Map being shown.

Actual result:
In case of Google Map widget it dies with js error "Uncaught ReferenceError: google is not defined". In case of Google Map D8 widget the Paragraph appears without the Map.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andrejsmuzikovs created an issue. See original summary.

quiron’s picture

I have the same problem, and I soved it with using $.ajax complete control. The patch is working for me.

Anyone can test please?

derjochenmeyer’s picture

Status: Active » Needs review

Status: Needs review » Needs work
RgnYLDZ’s picture

I don't know if this is related but I'm using views megarow that displays the node content. The node content has a dynamic map field as display.

Because the megarow is loaded on a click event manually, the google libraries are not loaded I think. So the first megarow content gives the "Uncaught ReferenceError: google is not defined" error.

The second megarow I click displays the content and the map without any problem.

Maby an approach like "Load libraries on every page" would solve this quickly, like the colorbox module.

derjochenmeyer’s picture

Status: Needs work » Postponed (maintainer needs more info)

Did anyone test this patch?

Status: Postponed (maintainer needs more info) » Needs work
rcodina’s picture

Similar problems with Inline Entity From. Same error:

Uncaught ReferenceError: google is not defined

The patch doens't work for me (for Inline Entity Form).

ChristianAdamski’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#2689921: Empty Google maps widget when using field in Paragraphs

Unless proven otherwise, this is assumed fixed by #2689921

Please test if issue still relevant.

RgnYLDZ’s picture

Status: Closed (duplicate) » Active

This issue is about D7.

Also the patch did not work for me. Still the first opening megarow table is not loading the map, the second one is.

ChristianAdamski’s picture

@RgnYLDZ,

sorry, I assumed D8.

GiorgosK’s picture

Same problem with dynamically loaded entity (which includes geolocation field map widget)
when using https://www.drupal.org/project/views_infinite_scroll

is there a way to call the map initilization on ajax.complete ?

GiorgosK’s picture

Tried

    $(document).ajaxComplete(function(){
      Drupal.attachBehaviors();
    });

but it does not work
anything else I could try ?

Bensbury’s picture

I couldn't apply the patch either.

error: patch failed: modules/geolocation_googlemaps/geolocation_googlemaps_widget.js:186
error: modules/geolocation_googlemaps/geolocation_googlemaps_widget.js: patch does not apply

Shame if it actually fixes the problem.

shawngo’s picture

I applied the patch manually and exported a new patch which applied cleanly to the latest dev. The patch also removes extra spacing and a couple coding standards issues.

The patch fixed the issue when loading the Google Map widget on a paragraph field.

ChristianAdamski’s picture

Hey,

how is this distinct from https://www.drupal.org/node/1277888?

tko’s picture

Patch from #15 fixed the problem.
But you're unable to add more than 1 paragraph which includes a map. The admin UI is blank for the second map. I suppose this is a separate issue?

CRZDEV’s picture

Component: Google Maps geolocation » Geolocation Field / Backend
Status: Active » Needs review
FileSize
4.07 KB

New patch to solve this problem, i realised that id was equal in all cases so here goes a new patch to solve that.
And also load google maps and execute callback function if required to prevent js exception: https://developers.google.com/maps/documentation/javascript/tutorial
This patch should work even with multiple and nested paragraphs. Please review.

CRZDEV’s picture

New patch to also allow multiple values.

unstatu’s picture

#19 works for me :) Thanks!

ChristianAdamski’s picture

Status: Needs review » Closed (won't fix)

Closing all 7.x issues. It's time.