Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #2
hannessWe are switching from Openlayers to Leaflet and now I have the same issue. Is there any solution?
Comment #3
hannessI fixed it for me by changing the Geofield field settings:
Available Features
I disabled:
PfadPolygonand disabled
Allow shape modificationNow it works. I did not dived deeper into it.
Comment #4
juves CreditAttribution: juves commentedSame in D8 version
Comment #5
itamair CreditAttribution: itamair as a volunteer commentedthis issue/feature has been implemented in D8 version with the last 8.x-1.0-beta9 release
Comment #6
itamair CreditAttribution: itamair as a volunteer commented... although the 8.x-1.0-beta10 has already been released as the Most stabled and advised one.
Comment #7
spacemuon CreditAttribution: spacemuon commentedFor 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,
);
Comment #8
spacemuon CreditAttribution: spacemuon commentedSee comment #7.