mirror of
https://github.com/a2nt/silverstripe-mapboxfield.git
synced 2024-10-22 14:05:53 +02:00
Update MarkerExtension.php
Add conditional logic to only display the mapbox if the override option isn't ticked.
This commit is contained in:
parent
18e242c17a
commit
af98273bf0
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user