Forum
Google Map field type change required after Google Maps API change to send stati...
Hi,
As I think you (Drew/Rachel) know, Google have recently changed the way they want you to access their Maps API (https://developers.google.com/maps/pricing-and-plans/standard-plan-2016-update) so new applications using their standard/free plan, have to include a key on every request.
So... this is fine in Perch's map field type for the actual JS map now you've added the config variable, but the default static image request is still going keyless (I tried in v 2.8.30 non).
I know I shouldn't be changed files in core, but needs must to get this site launched! Anyway, in file /perch/core/lib/PerchFieldTypes.class.php I changed line 1811 from:
$r .= '?center='.$clat.','.$clng.'&size='.$static_width.'x'.
$static_height.'&zoom='.$zoom.'&maptype='.$type;
to:
$r .= '?key='.PerchUtil::html($this->_get_api_key(),
true).'¢er='.$clat.','.$clng.'&size='.$static_width.'x'.
$static_height.'&zoom='.$zoom.'&maptype='.$type;
which just adds the key to the URL, nothing else.
Thanks, Paul.
Ok, thanks.
Just in case others see this, once I'd made the above change, I had to go into each region entry in the back-end admin and press the save button (twice!!) as simply republishing all pages didn't update the image requests (I guess it stores it in the database at edit time?).
Obviously if anyone hacks the product we're not going to offer them support.