Skip to content

Commit 7dbd5ed

Browse files
committed
FIX Issue BetterBrief#6
Fixing hard coded field names
1 parent 08d4763 commit 7dbd5ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

code/GoogleMapField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ public function __construct(DataObject $data, $title, $options = array()) {
3535

3636
// Create the latitude/longitude hidden fields
3737
$this->children = new FieldList(
38-
$this->latField = HiddenField::create($name.'[Latitude]', 'Lat', $this->getLatData())->addExtraClass('googlemapfield-latfield'),
39-
$this->lngField = HiddenField::create($name.'[Longitude]','Lng', $this->getLngData())->addExtraClass('googlemapfield-lngfield'),
38+
$this->latField = HiddenField::create($name . '[' . $fieldNames['lat'] . ']', 'Lat', $this->getLatData())->addExtraClass('googlemapfield-latfield'),
39+
$this->lngField = HiddenField::create($name . '[' . $fieldNames['lng'] . ']', 'Lng', $this->getLngData())->addExtraClass('googlemapfield-lngfield'),
4040
TextField::create('Search')
4141
->addExtraClass('googlemapfield-searchfield')
4242
->setAttribute('placeholder', 'Search for a location')
4343
);
4444

4545
parent::__construct($name, $title);
46-
4746
}
4847

4948
public function Field($properties = array()) {
@@ -57,6 +56,7 @@ public function Field($properties = array()) {
5756
'mapTypeId' => 'ROADMAP',
5857
),
5958
);
59+
6060
$jsOptions = array_merge($jsOptions, $this->options);
6161
$this->setAttribute('data-settings', Convert::array2json($jsOptions));
6262
return parent::Field($properties);

0 commit comments

Comments
 (0)