Google Maps plugin v4.2

Double Secret Blog
Google Maps plugin v4.2 image

Craft 4 Compatibility

With the recent release of Craft 4, we've updated the Google Maps plugin to be fully compatible and meet all new technical requirements. In fact, we're proud to say that all of our plugins are now compatible with Craft 4.

In addition to Craft 4 compatibility, we've introduced a few new features since the plugin's 4.1 release...

Required Subfields and/or Coordinates

It's now possible to require an Address field to have valid coordinates, and/or require specific subfields to be completed. This ensures that your Address values are valid according to your own internal business needs.

By default, only the coordinates will be required. And those requirements will only be enforced if you have also marked the field as "Required" in the field layout...

If you do not mark the Address field as "Required" in your field layout, none of the other requirements will be enforced.

Improved Universal Methods

We've also rounded out the JavaScript API to provide a complete set of tools for managing markers, info windows, and KML layers.

All of the following methods are now available as universal methods...

  • hideMarker(markerId)
  • showMarker(markerId)
  • openInfoWindow(markerId)
  • closeInfoWindow(markerId)
  • hideKml(kmlId)
  • showKml(kmlId)

More importantly, the markerId (or kmlId) parameter can accept any of these...

  • A single ID.
  • An array of IDs.
  • The string *, which will affect all markers (or KML layers).

Easily Change Marker Icons

Similarly, the setMarkerIcon method can now accept any of the formats noted above. This makes it a breeze to change the icon of multiple markers at the same time...

Use these methods to manipulate the map however you choose. Whether you chain these methods together or simply call one at a time, it opens the floodgates for what is possible on your map.

Bug Fixes & Performance Improvements

As always, we've continued to fix bugs and improve performance. Most notably, we've added some protections against the dreaded "grey box" scenario, where a map could appear as only a grey rectangle, because it was missing either the center coordinates or a zoom level. The plugin now provides better default values, making it nearly impossible to display a grey box by accident.

We hope you are enjoying the Google Maps plugin, thanks for using it in your Craft projects! Stay tuned as we continue to add new features and improvements far into the future. 💪

Related Posts:

Google Maps plugin v4.3 image
Google Maps plugin v4.3
Google Maps plugin v4.1 image
Google Maps plugin v4.1
Smart Map is dead. Long live Google Maps! image
Smart Map is dead. Long live Google Maps!

Recent Posts:

Craft 5 Plugin Retirements image
Craft 5 Plugin Retirements
Notifier graduates from Beta! image
Notifier graduates from Beta!
Mapbox plugin v1.1 image
Mapbox plugin v1.1