├── CHANGELOG ├── GoogleMaps ├── GoogleMapsTags.php ├── meta.yaml ├── resources │ ├── lang │ │ └── en │ │ │ └── settings.php │ └── views │ │ └── partials │ │ └── map.blade.php └── settings.yaml └── README.md /CHANGELOG: -------------------------------------------------------------------------------- 1 | 1.1.0 (2017-03-06) 2 | - Rewrote the entire JavaScript into a class 3 | - Add support for multiple maps 4 | - Add the ability to specify multiple markers on the map 5 | 6 | 1.0.0 (2016-07-29) 7 | - Initial release -------------------------------------------------------------------------------- /GoogleMaps/GoogleMapsTags.php: -------------------------------------------------------------------------------- 1 | getConfig('api_key', 'YOUR_API_KEY'); 18 | $zoom = $this->getParamInt('zoom', 10); 19 | $address = $this->getParam('address', 'New York'); 20 | $height = $this->getParam('height', '300px'); 21 | $width = $this->getParam('width', 'auto'); 22 | $markers = array_filter( 23 | explode(';', $this->getParam('markers')) 24 | ); 25 | 26 | $map_id = 'gmap' . uniqid(); 27 | 28 | if ($api_key == 'YOUR_API_KEY') { 29 | Log::error("GoogleMapsAddon: No api key specified"); 30 | } 31 | 32 | return $this->view('partials.map', compact('api_key', 'zoom', 'address', 'height', 'width', 'map_id', 'markers')); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /GoogleMaps/meta.yaml: -------------------------------------------------------------------------------- 1 | name: Google Maps 2 | version: 1.1.0 3 | description: Easily integrate google maps into your website 4 | url: https://github.com/krve/statamic-google-maps 5 | developer: Kristoffer Vestergaard 6 | developer_url: https://krve.io 7 | -------------------------------------------------------------------------------- /GoogleMaps/resources/lang/en/settings.php: -------------------------------------------------------------------------------- 1 | 'API Key', 5 | 'api_key_instruct' => 'Enter your Google Maps JavaScript API key' 6 | ]; 7 | -------------------------------------------------------------------------------- /GoogleMaps/resources/views/partials/map.blade.php: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /GoogleMaps/settings.yaml: -------------------------------------------------------------------------------- 1 | fields: 2 | api_key: 3 | type: text 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Installation 2 | 3 | Clone or download the repository and move the "GoogleMaps" folder into your `site/addons` folder. 4 | 5 | 6 | ### Setup 7 | 8 | Add your Google Maps JS API Key to the settings page `../cp/addons/google-maps/settings` 9 | 10 | 11 | ### Usage 12 | 13 | You can now use google maps like so: 14 | 15 | ``` 16 | {{ google_maps address="1600 Amphitheatre Parkway" height="400px" }} 17 | ``` 18 | 19 | ### Options 20 | 21 | The following options are available 22 | 23 | - address 24 | - height 25 | - width 26 | - zoom (The level of zoom) 27 | - markers 28 | 29 | #### Adding your own markers 30 | You can add your own markers to the map using the following syntax 31 | ``` 32 | {{ google_maps address="1600 Amphitheatre Parkway" height="400px" markers="Example Address 1;Example Address 2" }} 33 | ``` 34 | The `;` represents a split. Use this if you have multiple markers. 35 | 36 | ### Getting an API key 37 | You can find Google's own guide for getting an API key here: [https://developers.google.com/maps/documentation/javascript/get-api-key](https://developers.google.com/maps/documentation/javascript/get-api-key) 38 | 39 | 40 | ### Contribution 41 | 42 | Feel free to submit pull requests if you have any ideas on how to improve the addon. 43 | 44 | --------------------------------------------------------------------------------