Skip to content

Using the Field Type

Justin Kimbrell edited this page Aug 16, 2014 · 3 revisions

Overview

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.

Example

{% set options = {
	id: 'map', 
	width: '400px', 
	height: '300px'
} %}

{{ craft.googleMaps.map(options) }}

{% for entry in craft.entries.section('news') %}

	{{ craft.googleMaps.data('map', entry.map) }}

{% endfor %}

Clone this wiki locally