objectivehtml/Google-Maps-for-Craft

Customize info window

Closed this issue · 0 comments

Hi,
I'm trying to customize the info window of markers in my template. I was able to do exactly what I wanted with this code, but ran into the Geocoder limit mentioned in other issues here:

{% set store = entry.mapStore ~ '<br>' ~ entry.mapIndirizzo ~ '<br>' ~ entry.mapCap ~ ' ' ~ entry.mapCitta ~ '<br><a target="_blank" href="' ~ entry.url ~ '"><img src="/assets/img/arrow.svg"></a>' %}
      {% set address = entry.mapIndirizzo ~ ', ' ~ entry.mapCap ~ ' ' ~ entry.mapCitta ~ ', ' ~ entry.mapCountry %}
      {% set marker = {
          address: address,
          content: store,
          clustering: false
      } %}

      {{ craft.googleMaps.marker('map', marker) }}

So I modified my code to get around the Geocoder issue, but now I can't set the output of the info window content. I tried this:

{% set store = entry.mapStore ~ '<br>' ~ entry.mapIndirizzo ~ '<br>' ~ entry.mapCap ~ ' ' ~ entry.mapCitta ~ '<br><a target="_blank" href="' ~ entry.url ~ '"><img src="/assets/img/arrow.svg"></a>' %}

        {{ craft.googleMaps.data('map', entry.map, {
            markerOptions: {
            content: store }
        }) }}

But I guess I'm using markerOptions the wrong way. Is there a way to get this to work? Changing all info windows manually in the admin is not really an option or is there a way to set this globally?

Thanks in advance. And thanks for the great plugin.
Joern