Mapbox CMS field, Geocoding and Frontend UI for SilverStripe 4
Go to file
Tony Air 9df6f3148e
Map style support + JS linting
2019-09-07 09:05:03 +07:00
_config Initial commit 2018-11-29 17:38:20 +00:00
client Map style support + JS linting 2019-09-07 09:05:03 +07:00
docs/img Initial commit 2018-11-29 17:38:20 +00:00
src Initial commit 2018-11-29 17:38:20 +00:00
templates/Bigfork/SilverStripeMapboxField Add MapboxField_holder_small.ss 2019-04-10 12:54:43 +02:00
.editorconfig Initial commit 2018-11-29 17:38:20 +00:00
.gitignore Initial commit 2018-11-29 17:38:20 +00:00
LICENSE Initial commit 2018-11-29 17:38:20 +00:00
README.md 🐛 Update example to support 100+ longitudes 2018-12-07 15:11:53 +13:00
composer.json Initial commit 2018-11-29 17:38:20 +00:00
package.json Initial commit 2018-11-29 17:38:20 +00:00
webpack.config.js Initial commit 2018-11-29 17:38:20 +00:00
yarn.lock Initial commit 2018-11-29 17:38:20 +00:00

README.md

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.

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(11, 8)'
    ];

    public function getCMSFields()
    {
        // ...

        $fields->addFieldToTab(
            'Root.Map',
            MapboxField::create('LocationMap', 'Choose a location', 'Latitude', 'Longitude')
        );

        // ...
    }
}