View on Google Maps NOT WORKING
Permalink
When I try to load [Button press] of VIEW ON GOOFLE MAPS, the map area begins to load, then stops immediately and the users sees:
Oops! Something went wrong.
This page didn't load Google Maps correctly. See the JavaScript console for technical details.
This same thing happens on Safari, Firefox, and mobile devices.
AFTER POSTING, I think I found answer. Will this work?
To place the key, you'll need to override the google_map block's controller.php file, adding in the key to the script that is output by the registerViewAssets function.
- Create a folder google_map in /application/blocks
- Copy the controller.php file from /concrete/blocks/google_map/ into this new folder
- Rename the namespace the top of this file to:
namespace Application\Block\GoogleMap;
- Find the location where the script is output in the registerViewAssets function, and add in the key to the end of the script:
public function registerViewAssets($outputContent = '')
{
$this->requireAsset('javascript', 'jquery');
$this->addFooterItem(
'<script defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>'
);
}
Oops! Something went wrong.
This page didn't load Google Maps correctly. See the JavaScript console for technical details.
This same thing happens on Safari, Firefox, and mobile devices.
AFTER POSTING, I think I found answer. Will this work?
To place the key, you'll need to override the google_map block's controller.php file, adding in the key to the script that is output by the registerViewAssets function.
- Create a folder google_map in /application/blocks
- Copy the controller.php file from /concrete/blocks/google_map/ into this new folder
- Rename the namespace the top of this file to:
namespace Application\Block\GoogleMap;
- Find the location where the script is output in the registerViewAssets function, and add in the key to the end of the script:
public function registerViewAssets($outputContent = '')
{
$this->requireAsset('javascript', 'jquery');
$this->addFooterItem(
'<script defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>'
);
}
If you update to version 5.7.5.9, there is now an input field for the required Google Maps API key.
For more information on getting an API key and using the Google Map block, please review the block documentation.
http://documentation.concrete5.org/editors/in-page-editing/block-ar...