Skip to content

Latest commit

 

History

History
44 lines (38 loc) · 1.51 KB

AddingMapToADataObject.md

File metadata and controls

44 lines (38 loc) · 1.51 KB

#Adding a Map to a DataObject ##Add Extension Using the standard method of adding extensions in SilverStripe 3.1, add an extension called 'MapExtension' to relevant DataObjects.

---
name: weboftalent-example-map-extensions
---
PageWithMap:
	extensions:
		['MapExtension']

##Editing Utilising the extensions adds Latitude, Longitude and Zoom fields to the DataObject in question, in the example above 'PageWithMap'. In addition, the admin interface for PageWithMap now has a location tab. Location can be changed in 3 ways:

The zoom level set by the content editor is also saved.

##Templates To render a map in the template, simply called $BasicMap

<h1>$Title</h1>
$Content
$BasicMap

For an example of this, see http://demo.weboftalent.asia/mappable/quick-map-adding-a-map-to-a-dataobject/

##Custom Popup When clicking on the pin a popup with the name of the pin will occur.

If you want to change the information displayed there you have to setup a template named by the decorated DataObject suffixed with _MapInfoWindow, e.g. MyPage_MapInfoWindow.