Update MarkerExtension.php
Override Lat Lng was not displaying editable fields. Added logic to check status and display either the MapBox or the editable fields.
This commit is contained in:
parent
18e242c17a
commit
8615b55579
|
@ -4,6 +4,7 @@
|
|||
namespace A2nt\SilverStripeMapboxField;
|
||||
|
||||
use SilverStripe\Forms\CheckboxField;
|
||||
use SilverStripe\Forms\TextField;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use Symbiote\Addressable\Geocodable;
|
||||
use Symbiote\Addressable\Addressable;
|
||||
|
@ -36,8 +37,19 @@ class MarkerExtension extends Geocodable
|
|||
$fields->addFieldsToTab('Root.Map', [
|
||||
CheckboxField::create('LatLngOverride', 'Override Latitude and Longitude?')
|
||||
->setDescription('Check this box and save to be able to set the latitude and longitude manually.'),
|
||||
MapboxField::create('Map', 'Choose a location', 'Lat', 'Lng'),
|
||||
]);
|
||||
]);
|
||||
|
||||
if ($record->LatLngOverride) {
|
||||
$fields->addFieldsToTab('Root.Map', [
|
||||
TextField::create('Lat', 'Latitude'),
|
||||
TextField::create('Lng', 'Longitude'),
|
||||
]);
|
||||
}
|
||||
else {
|
||||
$fields->addFieldsToTab('Root.Map', [
|
||||
MapboxField::create('Map', 'Choose a location', 'Lat', 'Lng'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDirectionsURL()
|
||||
|
|
Loading…
Reference in New Issue