objectivehtml / Google-Maps-for-Craft

The complete geolocation toolkit for Craft CMS.
Other
94 stars 19 forks source link

Test for No Results #61

Open jonlongnecker opened 8 years ago

jonlongnecker commented 8 years ago

I'm attempting to wrap an if statement around my maps code so that a blank map doesn't show up when there are no locations plotted. With 'blogLocations' being my custom field handle, I've tried these with no luck:

{% if entry.blogLocations is not null %}
{% if not entry.blogLocations|length %}
{% if not entry.blogLocations.total() %}
{% if entry.blogLocations is empty %}
{% if entry.blogLocations %}

What is the syntax for checking my field for no results??

jonlongnecker commented 8 years ago

Playing around a bit more I was able to get this to work by calling on the markers function:

{% if entry.blogLocations.getMarkers is not empty %}