egeloen / ivory-google-map

Google Map API v3 integration for PHP 5.6+.
MIT License
325 stars 185 forks source link

Placing multiple maps on a single page results in only the latter not to be rendered #281

Open Defcon0 opened 6 years ago

Defcon0 commented 6 years ago

Hello,

I have issues placing multiple maps on a single page. The problem is that there's only one single callback function:

https://www.google.com/jsapi?callback=ivory_google_map_load

In this function the one map is rendered that the code resulted from. But since this function has no hash in its name like ivory_google_map_load_e489f39a9a48the two functions override themselves. And each of the function only initiates the one of the 2 maps.

How can I fix this? Is it a bug?

Bye

Defcon0 commented 6 years ago

Update on this: Seems that this can be fixed very easily:

I added some random id in Ivory\GoogleMap\Helper\Renderer\ApiRenderer->getCallbackName():

return 'ivory_google_map_'.$callback.'_'.uniqid();

@egeloen Would that be an option to include in the core?