As of June 22, 2016, Google has changed their policy regarding the standard plan of Google Maps API as they announced in their blog post. Keyless access to the API is no longer supported.
With the above said, the older implementation of Google Maps in our themes may become unavailable.
Our current implementation of Google Maps has been enriched with a Google Maps API Key setting.
To find it, please, go to the Appearance settings of your theme and find Google Maps API Key under the the MTT THEME SETTINGS tab:
To generate your own API Key for Google Maps, please, follow the steps described in Google's official documentation at https://developers.google.com/maps/documentation/javascript/get-api-key.
After setting your own Google Maps API Key and saving the changes, please, do not forget to clear your Drupal cache.
If the aforementioned setting is not available for your theme installation, please follow the corresponding guide below depending on the Drupal version that you are using.
Drupal 8
- Please follow the steps mentioned in the official Google documentation in order to generate your own Google Maps Javascript API Key.
- Open the theme_name.libraries. yml file located in the root folder of your theme with your favourite text editor.
- Locate the google-maps library and specifically, the 5th line that mentions the Google maps API js file URL
https://maps.googleapis.com/maps/api/js?v=3: { scope: 'footer' }
- Change this url by adding your key right after the v=3 like the example below
https://maps.googleapis.com/maps/api/js?v=3&key=YOUR_KEY: { scope: 'footer' }
- Save your changes and clear your Drupal cache.
Drupal 7
- Please follow the steps mentioned in the official Google documentation in order to generate your own Google Maps Javascript API Key.
- Open the template.php file located in the root folder of your theme with your favourite text editor.
- Locate the Google map js configuration section. Hint: Searching for ‘https://maps.googleapis.com/maps/api/js’ will point you to the correct lines
- Locate the specific line that contains the Google maps API js file URL. This should be similar the example below:
drupal_add_js('https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false',array('type' => 'external', 'scope' => 'header', 'group' => 'JS_THEME'));
- Change this url by adding your key right after the sensor=false section like the example below:
drupal_add_js('https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=YOUR_KEY',array('type' => 'external', 'scope' => 'header', 'group' => 'JS_THEME'));
- Save your changes and clear your Drupal cache.