diff --git a/src/MarkerExtension.php b/src/MarkerExtension.php index 06b8c1f..9a7dcce 100644 --- a/src/MarkerExtension.php +++ b/src/MarkerExtension.php @@ -36,8 +36,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'), ]); + #Show map, or coordinates if override is ticked. + 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()