'Text',
'Longitude' => 'Varchar(255)',
'Latitude' => 'Varchar(255)',
'MapZoom' => 'Int',
'MapAPIKey' => 'Varchar(255)'
];
private static $many_many = [
'Navigation' => SiteTree::class,
];
public function updateCMSFields(FieldList $fields)
{
$tab = $fields->findOrMakeTab('Root.Main');
$tab->push(TreeMultiselectField::create(
'Navigation',
'Navigation',
SiteTree::class
));
$tab->push(TextareaField::create('ExtraCode', 'Extra site-wide HTML code'));
$mapTab = $fields->findOrMakeTab('Root.GoogleMaps');
$mapTab->push(TextField::create('MapAPIKey'));
$mapTab->push(TextField::create('MapZoom'));
$mapTab->push(GoogleMapField::create(
$this->owner,
'Location'
));
}
public function getGeoJSON()
{
return '{"type": "MarkerCollection","features": [{"type": "Feature","icon": "",'
.'"properties": {"content": "'.$this->owner->getTitle().'"},"geometry": {"type": "Point",'
.'"coordinates": ['.$this->owner->getField('Longitude').','.$this->owner->getField('Latitude').']}}]}';
}
public function DirectionsLink()
{
return ''
.' Get Directions';
}
}