-
Notifications
You must be signed in to change notification settings - Fork 19
Using the Field Type
objectivehtml edited this page Sep 11, 2014
·
2 revisions
Using the field type to add data to a map is pretty straight forward. The field type returns a GoogleMaps_MapDataModel object which is then passed to a craft.googleMaps.data() method. The data is extrapolated and passed into the browser where it is rendered with JavaScript. In this example map is the name of the field, and news is the section.
{% set options = {
id: 'map',
width: '400px',
height: '300px'
} %}
{{ craft.googleMaps.map(options) }}
{% for entry in craft.entries.section('news') %}
{{ craft.googleMaps.data('map', entry.yourMapField) }}
{% endfor %}