I'm using the Smart Map plugin, and I can't seem to figure out how to output all the locations of my entries from a single section onto one single map.
I think the issue I'm having is trying to get the information out from a Matrix block within each entry or knowing where to start!
The section is 'buildings' which contains all the building entries. For each entry, there is a matrix block called 'buildingContent' which has 5 matrix blocks, and the one I want to pull information from is 'howToGetThere' (last block out of the matrix array). In this block, I have a field 'smartMap' which contains the location of the building.
How would I extract the location from the 'smartMap' field for all my entries and output them onto one single map?
I know the code below outputs the location of one entry (St Bartholomew The Great), but thought it might be useful to include what I've tried so far. I adapted it from the documentation:
{% set entry = craft.entries.slug('st-bartholomew-the-great').first %}
{% set locations = entry.buildingContent %}
{% set options = {
height: 600,
zoom: 13,
draggable: true,
markerInfo: '_includes/mapInfoBubble',
markerOptions: {
icon: 'images/map-marker2.svg',
}
} %}
{{ craft.smartMap.map(locations[4], options) }}
Any help much appreciated, thanks!