mirror of
https://github.com/a2nt/silverstripe-mapboxfield.git
synced 2024-10-22 12:05:53 +00:00
SilverStripe Mapbox Field
Adds a Mapbox map to the CMS with a draggable marker to allow content authors to add a location to a DataObject or Page.
![](/tonyair/silverstripe-mapboxfield/media/commit/2d0b23cbc3daf123222e4fd82bdb122e7f8afa95/docs/img/cms.png)
Installation
composer require bigfork/silverstripe-mapboxfield:*
Configuration
---
Name: 'app-mapbox'
After: 'silverstripe-mapboxfield'
---
Bigfork\SilverStripeMapboxField\MapboxField:
access_token: '<your mapbox key>'
Usage
class MyDataObject extends DataObject
{
private static $db = [
'Latitude' => 'Decimal(10, 8)',
'Longitude' => 'Decimal(10, 8)'
];
public function getCMSFields()
{
// ...
$fields->addFieldToTab(
'Root.Map',
MapboxField::create('LocationMap', 'Choose a location', 'Latitude', 'Longitude')
);
// ...
}
}
Description
Languages
PHP
52.3%
JavaScript
33.6%
Scheme
11.9%
SCSS
2.2%