@@ -5,11 +5,12 @@ silverstripe-googlemapfield
5
5
6
6
Lets you record a precise location using latitude/longitude/zoom fields to a DataObject.
7
7
8
- Displays a map using the Google Maps API. The user may then choose where to place the marker; the landing coordinates are then saved.
8
+ Displays a map using the Google Maps API. The user may then choose where to place the marker; the landing coordinates
9
+ are then saved.
9
10
10
11
You can also search for locations using the search box, which uses the Google Maps Geocoding API.
11
12
12
- Supports SilverStripe 4
13
+ Supports SilverStripe 4 and Userforms
13
14
14
15
## Usage
15
16
@@ -29,19 +30,18 @@ class Store extends DataObject
29
30
'Latitude' => 'Varchar',
30
31
'Longitude' => 'Varchar',
31
32
];
32
-
33
+
33
34
public function getCMSFields() {
34
35
$fields = parent::getCMSFiels();
35
-
36
+
36
37
// add the map field
37
38
$fields->addFieldToTab('Root.Main', new GoogleMapField(
38
- $this,
39
39
'Location'
40
40
));
41
-
41
+
42
42
// remove the lat / lng fields from the CMS
43
43
$fields->removeFieldsFromTab('Root.Main', ['Latitude', 'Longitude']);
44
-
44
+
45
45
return $fields;
46
46
}
47
47
}
@@ -113,4 +113,4 @@ To get a Google Maps JS API key please see [the official docs](https://developer
113
113
# # Geocoding access - enabling the search box
114
114
115
115
To use the search box to find locations on the map, you'll need to have enabled the Geocoding API as well. Please see
116
- [the official docs](https://developers.google.com/maps/documentation/javascript/geocoding#GetStarted)
116
+ [the official docs](https://developers.google.com/maps/documentation/javascript/geocoding#GetStarted)
0 commit comments