Views "No results behavior" ignored when no results on a Geolocation common map

Created on 21 September 2023, over 1 year ago

Problem/Motivation

When there are no results (no markers) on a Views Geolocation common map, I woud like to see the "No results behaviour", rather than an empty map.

Steps to reproduce

(1) new Drupal 10.1.4 site with standard installation
(2) composer require drupal/geolocation
(3) drush en -y geolocation_address geolocation_google_maps
(4) /admin/structure/types/manage/page/fields/add-field
(5) Add a field of type "Geolocation" called geolocation and machine name field_geolocation
(6) Go to /node/add/page
(7) Create a page with a latitude 42.9485412, and longitude -74.3694919 and title "test"
(8) Go to /admin/structure/views/add
(9) Make a view called "test" showing Content of type "Basic Page"
(10) Add the field "Geolocation"
(11) Make the format of the view "Geolocation common map"
(12) Your views preview should now show a map with one item
(13) Add a filter Proximity (field_geolocation)
(14) Put, in operator, "Is less than", and in the distance, "100"
(15) For location input, choose "Geocoder address input"
(16) In "No results behaviour", choose Text and write "No results"
(17) In the preview section, you will see a section to enter "Latitude and longitude"
(18) Enter latitude 42.9485412, and longitude -74.3694919 and apply
(19) Confirm that you see a marker on the map, this is because the search coordinates are less than 100km from the location on the page
(20) Now enter latitude 48.85837009999999 and longitude 2.2944813 (the location of the Eiffel Tower)
(21) Confirm that the map shows zero markers, this is because our page location is further than 100km from the Eiffel Tower

At step 21 I would expect to see no map, and to see "No results", but I see a map with no markers in it.

Proposed resolution

If there are no results on a view, do not show the map at all; rather show the results of "No results behaviour".

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

3.0

Component

Geolocation Field / Backend

Created by

🇨🇦Canada alberto56

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @alberto56
  • Status changed to Fixed over 1 year ago
  • 🇨🇦Canada alberto56

    I found the solution: in order to _not_ show the map when there are no locations, go to the view, then in the "format" section, click settings next to "Geolocation CommonMap", and once there, uncheck "Display map when no locations are found".

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024