deved-it / grav-plugin-google-maps Goto Github PK
View Code? Open in Web Editor NEWGoogle Maps plugin for Grav
License: MIT License
Google Maps plugin for Grav
License: MIT License
Hello,
yesterday after updating shortcode core plugin from 3.1.0 to 3.1.2 maps won't work.
Do someone know how to fix?
sorry for my bad english!!
Hello,
I've used this plugin to display a map on a website I'm creating but the custom location marker is not showing up on the map. It's a 68px * 100px PNG image and I've put the absolute path in the code but it's not showing up on the map.
Url of the page with the map: https://coraliememe-naturopathe.fr/contact
Why is that?
Thanks!
When I entered google maps code into a simple page, HTML validator shows this error:
No p element in scope but a p end tag seen.
The code looks this:
<p><div id="map-6b62c0c981" class="google-map" style="width: 100%; height: 400px"↩
data-lat="48.578131"↩
data-lng="19.152726"↩
data-zoom="16"↩
data-scrollwheel="true"↩
data-draggable="1"↩
data-pancontrol="true"↩
data-iconurl=""↩
data-infowindow="">↩
</div>↩
</p>↩
The problem is the google maps code is inside of p tags.
Hello,
I tried to install the plugin via bin/gpm install google-maps
, the installation succeed, but if I try to access to my website (localhost with Wamp or online, I tried both) I got this error:
Whoops\Exception\ErrorException thrown with message "Non-static method Grav\Common\Plugin::isAdmin() should not be called statically"
Stacktrace:
#11 Whoops\Exception\ErrorException in C:\wamp\www\grav\user\plugins\google-maps\google-maps.php:25
#10 Grav\Common\Plugin:isAdmin in C:\wamp\www\grav\user\plugins\google-maps\google-maps.php:25
#9 Grav\Plugin\GoogleMapsPlugin:getSubscribedEvents in C:\wamp\www\grav\vendor\symfony\event-dispatcher\EventDispatcher.php:139
#8 Symfony\Component\EventDispatcher\EventDispatcher:addSubscriber in C:\wamp\www\grav\system\src\Grav\Common\Plugins.php:104
#7 Grav\Common\Plugins:init in C:\wamp\www\grav\system\src\Grav\Common\Processors\PluginsProcessor.php:18
#6 Grav\Common\Processors\PluginsProcessor:process in C:\wamp\www\grav\system\src\Grav\Common\Grav.php:126
#5 Grav\Common\Grav:Grav\Common{closure} in C:\wamp\www\grav\system\src\Grav\Common\Grav.php:368
#4 Grav\Common\Grav:Grav\Common{closure} in C:\wamp\www\grav\system\src\Grav\Common\Grav.php:344
#3 call_user_func_array in C:\wamp\www\grav\system\src\Grav\Common\Grav.php:344
#2 Grav\Common\Grav:__call in C:\wamp\www\grav\system\src\Grav\Common\Grav.php:127
#1 Grav\Common\Grav:measureTime in C:\wamp\www\grav\system\src\Grav\Common\Grav.php:127
#0 Grav\Common\Grav:process in C:\wamp\www\grav\index.php:52
If I uninstall the plugin, everything works as a charm.
Do you have any idea ?
Thank you in advance.
This may be the same or related to #22 but I can't be sure from its description. I apologise that my problem description may also be vague and difficult to reproduce. It has been tricky to pin it down to a pattern. I'll try to describe my environment comprehensively, please let me know if more info is required.
The behaviour I see is that when I enable caching on a page with maps, the map (and library) load the first time, but not on subsequent refreshes - obviously I see a blank div where the map should be. The javascript code is not included in the source. This is easy to work around for individual pages (using cache_enable
in frontmatter but it would be better to find the cause :)
I have extended your plugin to add support for map Places shortcodes but I don't think my extensions modify any original plugin code. (When I have time to make the code more generic, I will submit my fork with new features as a pull request.)
Asset pipeline settings seem to make no difference, as I originally thought that was the problem.
I'm running Grav on nginx with the following plugins, all up to date:
I also have three custom plugins but none of them use Javascript at the moment. I'm extending the Antimatter theme.
Hope that helps. Please let me know if you require more details.
If you add the width or height parameters with single-quotes in the shortcode, those values do not get properly passed to the style attribute in the div, and simply fall back on the set defaults.
You need to use double-quotes to have those values passed properly.
This is probably an issue more with shortcodes in general, rather than this Maps plugin in particular, but updating your example would be helpful.
Could this feature be enhanced?
I am quite fresh Grav user and I am struggling with using your plugin.
I have instlled fresh grav with admin plugin (no extras) and added three plugins to check it:
Google maps (added via admin panel)
Shordcode core (added as depenency gy grav admin panel)
Shortcode UI (added via admin panel)
Shortcodes from Shortcode UI are working fine, but shortcode from Google maps doesn't work (Google API key is added).
You may see how it looks like on this page:
http://choinki2.twojedecyzje.pl/
Any suggestion is welcome, maybe I am doing something wrong.
After the installation it gives me this error E_DEPRECATED – Non-static method Grav\Common\Plugin::isAdmin() should not be called statically. It is installed locally using WAMP 3.0.6. All other plugins are installed and working correctly.
When API key was entered and save, there will be an error "Array to string conversion".
Shortcode interpreted correctrly but missing google-maps js link in modular pages.
am hoping to use the plugin and it appears to want to work . on first load of the page the map works fine. when i leave the page and return to the map the page wont load. or it loads but map is not visible. to view the map again i need to clear the grav cache and when done the map shows again. any ideas what is happening here. im getting the same result in firefox and konquror. the map is located http://45.55.176.255/locate. any insight would be really appreciated
Since update to Grav 1.1.13 (as well as 1.1.14) Google maps don't display.
Is this plugin being maintained? Not much activity.
I am probably doing something wrong (not a coder) but where do I put the json content? I just tried this from the readme file. The non json example does work
[google-maps width='100%' zoom=2 scrollwheel=true panControl=true content=json]
[
{"key":"20:53", "lat": 22.42559832, "lng": 114.2123749 },
{"key":"21:09", "lat": 22.41401143, "lng": 114.21253759 },
{"key":"21:20", "lat": 22.42327849, "lng": 114.21259051 },
{"key":"21:42", "lat": 22.44140609, "lng": 114.17303335 }
]
[/google-maps]
Map is empty. Am I missing something?
Anyone using this with json?
Hi,
it's possible include the google map in a twig template?
Thanks,
Andrea
While trying to get the api-key from the config I realized, that twig does not allow a minus in a variable key. I will create a pull request soon with all mentions of google-maps replaced with googlemaps.
twigphp/Twig#277
When I installed this plugin via gpm cli, this happened.
root@zoid:/srv/zoid/grav# bin/gpm install google-maps
GPM Releases Configuration: Stable
The following dependencies need to be installed...
|- Package shortcode-core
Install this package? [Y|n] Y
Preparing to install Shortcode Core [v2.3.1]
|- Downloading package... 100%
|- Checking destination... ok
|- Installing package... ok
'- Success!
Dependencies are OK
Preparing to install Google Maps [v1.0.6]
|- Downloading package... 100%
|- Checking destination... ok
|- Installing package... ok
'- Success!
Clearing cache
Cleared: /srv/zoid/grav/cache/twig/*
Cleared: /srv/zoid/grav/cache/compiled/*
Cleared: /srv/zoid/grav/images/*
Touched: /srv/zoid/grav/user/config/system.yaml
root@zoid:/srv/zoid/grav# bin/gpm install recaptchacontact
PHP Fatal error: Cannot redeclare class Grav\Plugin\GoogleMapsPlugin in /srv/zoid/grav/user/plugins/google-maps/google-maps.php on line 55
root@zoid:/srv/zoid/grav# bin/gpm install recaptchacontact
PHP Fatal error: Cannot redeclare class Grav\Plugin\GoogleMapsPlugin in /srv/zoid/grav/user/plugins/google-maps/google-maps.php on line 55
root@zoid:/srv/zoid/grav# bin/gpm uninstall googlmapsplugin
PHP Fatal error: Cannot redeclare class Grav\Plugin\GoogleMapsPlugin in /srv/zoid/grav/user/plugins/google-maps/google-maps.php on line 55
root@zoid:/srv/zoid/grav# bin/gpm uninstall googlmapsplugin
PHP Fatal error: Cannot redeclare class Grav\Plugin\GoogleMapsPlugin in /srv/zoid/grav/user/plugins/google-maps/google-maps.php on line 55
root@zoid:/srv/zoid/grav# cd user/plugins
root@zoid:/srv/zoid/grav/user/plugins# rm -rf google*
root@zoid:/srv/zoid/grav/user/plugins# bin/gpm uninstall googlmapsplugin
-bash: bin/gpm: No such file or directory
root@zoid:/srv/zoid/grav/user/plugins# cd ..
root@zoid:/srv/zoid/grav/user# cd ..
root@zoid:/srv/zoid/grav# bin/gpm uninstall googlmapsplugin
Nothing to uninstall.
root@zoid:/srv/zoid/grav#
but even with the package removed the problem went on. I was getting 500 errors, so in my php error.log it says
2016/10/26 22:35:07 [error] 12538#0: *5 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Opening file for writing failed on error fopen(/srv/zoid/grav/cache/compiled/blueprints/master-zoid.php): failed to open stream: Permission denied' in /srv/zoid/grav/vendor/rockettheme/toolbox/File/src/File.php:202
Stack trace:
#0 /srv/zoid/grav/vendor/rockettheme/toolbox/File/src/File.php(316): RocketTheme\Toolbox\File\File->lock()
#1 /srv/zoid/grav/vendor/rockettheme/toolbox/File/src/PhpFile.php(31): RocketTheme\Toolbox\File\File->save(Array)
#2 /srv/zoid/grav/system/src/Grav/Common/Config/CompiledBase.php(236): RocketTheme\Toolbox\File\PhpFile->save(Array)
#3 /srv/zoid/grav/system/src/Grav/Common/Config/CompiledBase.php(100): Grav\Common\Config\CompiledBase->saveCompiledFile('/srv/hudsonpian...')
#4 /srv/zoid/grav/system/src/Grav/Common/Service/ConfigServiceProvider.php(65): Grav\Common\Config\CompiledBase->load()
#5 /srv/zoid/grav/system/src/Grav/Common/Serv" while reading response header from upstream, client: 24.105.233.41, server: , request: "GET /grav/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/ajenti-v-php-fcgi-zoidcom-php-fcgi-0.sock:", host: "zoid"
This is what happened the first time. I removed the plugin folders, then had to chmod -R a+w grav for it to stop erring. The second time I tried to see if it was consistent. I was able to uninstall it through gpm perfectly fine, and the error stopped happening once I did that. This could be because I had changed file permissions of the google* folders to 777 while in FTP because it wasn't letting me remove them, thus the rm -rf.
When I install via admin panel it works fine. Please see if you can reproduce. Grav v1.1.8
I'm running ajenti-v with this configuration http://support.ajenti.org/topics/1267-tutorial-installing-grav-on-ajenti-v/
Trying out the plugin the current grav version I had the problem that the javascript was missing after the first call.
Changing the code in MapShortcode.php to
$this->shortcode->addAssets('js', '//maps.googleapis.com/maps/api/js'.$apikeystring);
$this->shortcode->addAssets('js', 'plugin://google-maps/js/google-maps.js');
helped.
A fatal error occurred when I tried to update this plugin within Admin.
Non-static method Grav\Common\Plugin::isAdmin() should not be called statically
in
…/user/plugins/google-maps/google-maps.php 25
It breaks Admin and also my whole grav website. Luckily I took a backup just before this.
I have PHP Version 5.6.25 if it's any help. My Grav is at version 1.1.17, and Admin 1.2.2.
Hello!
Can you turn on language support?
https://developers.google.com/maps/documentation/javascript/localization?hl=en
The map will not come up if minifiers are enabled. (external CSS and JS)
Grav 1.1.12
Uncaught ReferenceError: google is not defined
at HTMLDivElement.<anonymous> (a0969a1….js:75)
at Function.each (a0969a1….js:1)
at n.fn.init.each (a0969a1….js:1)
at HTMLDocument.<anonymous> (a0969a1….js:75)
at j (a0969a1….js:1)
at Object.fireWith [as resolveWith] (a0969a1….js:1)
at Function.ready (a0969a1….js:1)
at HTMLDocument.K (a0969a1….js:1)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.