Skip to content

Commit

Permalink
Fix: add Google API key to address fieldtype
Browse files Browse the repository at this point in the history
  • Loading branch information
christianruhstaller committed Apr 4, 2017
1 parent 372ad8f commit 8973f5d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fieldtypes/GoogleMaps_AddressFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ public function getInputHtml($name, $value)
{
$id = craft()->templates->formatInputId($name);

$pluginSettings = craft()->plugins->getPlugin('GoogleMaps')->getSettings();
$key = $pluginSettings->apiKey;

// Figure out what that ID is going to look like once it has been namespaced
$namespacedId = craft()->templates->namespaceInputId($id);

craft()->templates->includeJsResource('googlemaps/js/app.compiled.js');
craft()->templates->includeCssResource('googlemaps/css/app.css');
craft()->templates->includeJsFile('//maps.googleapis.com/maps/api/js?key=&sensor=false&callback=GoogleMaps.init');
craft()->templates->includeJsFile('//maps.googleapis.com/maps/api/js?key='.$key.'&sensor=false&callback=GoogleMaps.init');

craft()->templates->includeJs("
var data = ['#$namespacedId-field .oh-google-map-wrapper', {
Expand Down

0 comments on commit 8973f5d

Please sign in to comment.