Proximity search doesn't work anymore since 3.10

Created on 18 July 2022, almost 3 years ago
Updated 16 May 2025, 22 days ago

Problem/Motivation

After updating from 3.9 to 3.10 of this module, the proximity search doesn't work anymore. The problem seems to be situated in ProximityFilter. The code in acceptExposedInput() and query() has changed in this release and the problem is that in the form values in _center in 3.10 lat and lng are 0.

I think the code in

https://git.drupalcode.org/project/geolocation/-/blob/8.x-3.9/src/Plugin...

is missing in some way.

As a workaround I added the following form submit handler:

function my_project_form_views_exposed_form_alter(&$form, $form_state, $form_id) {
    $form['#submit'] = [function($form, &$form_state) {
      $form_state->setValue('geo_location_proximity_center', [
        'coordinates' => [
          'lat' => $form_state->getValue('lat'),
          'lng' => $form_state->getValue('lng'),
        ]
      ]);
    }, $form['#submit'][0]];
}

Now it works again, but this is simply a workaround.

Steps to reproduce

Create a view with a proximity search filter and submit the form -> no filtering takes place.

Proposed resolution

I'm not deep enough in the module's code to say that, sorry.

Thanks in advance for a fix!

Bye Defcon0

🐛 Bug report
Status

Closed: outdated

Version

3.10

Component

Geolocation Field / Backend

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024