I have a content type where the user gives a location, this is not a mandatory field. When the user don't provide location the node shows a grey map. Is there a way to remove the grey map from showing up? I want it to be hidden if empty. Could anyone provide some help here?

Comments

mmatmaga created an issue.

hanness’s picture

We are switching from Openlayers to Leaflet and now I have the same issue. Is there any solution?

hanness’s picture

I fixed it for me by changing the Geofield field settings:

Available Features

  • Point

I disabled:

  • Pfad
  • Polygon

and disabled

  • Allow shape modification

Now it works. I did not dived deeper into it.

juves’s picture

Same in D8 version

itamair’s picture

this issue/feature has been implemented in D8 version with the last 8.x-1.0-beta9 release

itamair’s picture

... although the 8.x-1.0-beta10 has already been released as the Most stabled and advised one.

spacemuon’s picture

For D7, To hide empty maps, I still have to unpublish/publish or select edit and save (without making changes) to each node.

Any recommendations?

Other Setup & Config TIPS
In Views, Content: Coordinates, No Results Behavior - select the Hide if empty check box.
Refresh cache
In Views, Format: Map (Leaflet API, via IPGV&M) settings - select 'none' for Name of longitude field in Views query, except as noted.
If still not working for existing content, try unpublish/publish or update content.

Recommendations
For future Leaflet versions, set Hide if empty as Default.

leaflet_views_plugin_style.inc

$form['hide_empty'] = array(
'#title' => t('Hide empty'),
'#type' => 'checkbox',
'#description' => t('Hide the Leaflet map if there are no results to display.'),
'#default_value' => TRUE,
);

spacemuon’s picture

See comment #7.