File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -16,3 +16,6 @@ BetterBrief\GoogleMapField:
16
16
default_field_values :
17
17
Latitude : 30
18
18
Longitude : 0
19
+ center :
20
+ Latitude : 30
21
+ Longitude : 0
Original file line number Diff line number Diff line change 14
14
}
15
15
field . data ( 'gmapfield-inited' , true ) ;
16
16
var settings = JSON . parse ( field . attr ( 'data-settings' ) ) ,
17
- centre = new google . maps . LatLng ( settings . coords [ 0 ] , settings . coords [ 1 ] ) ,
17
+ centre = new google . maps . LatLng ( settings . center [ 0 ] , settings . center [ 1 ] ) ,
18
18
mapSettings = {
19
19
streetViewControl : false ,
20
20
zoom : settings . map . zoom * 1 ,
Original file line number Diff line number Diff line change @@ -155,6 +155,10 @@ public function Field($properties = array()) {
155
155
$ this ->recordFieldData ('Latitude ' ),
156
156
$ this ->recordFieldData ('Longitude ' )
157
157
),
158
+ 'center ' => array (
159
+ $ this ->getLatData () ?: $ this ->getOption ('center.Latitude ' ),
160
+ $ this ->getLngData () ?: $ this ->getOption ('center.Longitude ' ),
161
+ ),
158
162
'map ' => array (
159
163
'zoom ' => $ this ->recordFieldData ('Zoom ' ) ?: $ this ->getOption ('map.zoom ' ),
160
164
'mapTypeId ' => 'ROADMAP ' ,
@@ -242,15 +246,15 @@ public function getDefaultValue($name) {
242
246
*/
243
247
public function getLatData () {
244
248
$ fieldNames = $ this ->getOption ('field_names ' );
245
- return $ this ->data ->$ fieldNames ['Latitude ' ];
249
+ return $ this ->data ->{ $ fieldNames ['Latitude ' ]} ;
246
250
}
247
251
248
252
/**
249
253
* @return string The VALUE of the Longitude field
250
254
*/
251
255
public function getLngData () {
252
256
$ fieldNames = $ this ->getOption ('field_names ' );
253
- return $ this ->data ->$ fieldNames ['Longitude ' ];
257
+ return $ this ->data ->{ $ fieldNames ['Longitude ' ]} ;
254
258
}
255
259
256
260
/**
You can’t perform that action at this time.
0 commit comments