Problem/Motivation

When creating a map views with geofield and leaflet, I would like to allow end-user update the exposed proximity filter original coordinates by:

  • Moving the map with mouse click
  • Capture the "moveend" Leaflet event with JS
  • Using JQuery to update the exposed proximity filter original coordinates, with current map center Lat/Lng
  • User click on "search" button will now showing an updated result, based on Lat/Lng just captured

From this point of view, end-user shouldn't manually update the exposed proximity filter form (both the operator for distance, Latitude and Longitude). The form should therefore set as visually-hidden with CSS.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3253231

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hswong3i created an issue. See original summary.

hswong3i’s picture

Title: Visually Hide the Exposed Form » Visually Hide the Views Exposed Filter Form
hswong3i’s picture

Version: 9.4.x-dev » 9.3.x-dev

hswong3i’s picture

Version: 9.3.x-dev » 9.4.x-dev
Status: Active » Needs review
lendude’s picture

Status: Needs review » Needs work

@hswong3i thanks for opening this and working on it.

Since this can be easily done with a hook or some CSS and it feels like an edge case that you would need to expose a filter and then hide it, I'm not sure we need to support this in core.

If we were to add it, it would need test coverage and an update path (and a test for this upgrade).

hswong3i’s picture

Some general use case I could think about:

  • Create some exposed filter which not expected to be change by end-user directly, but though some logic with Javascript for translate the end-user action into meaningful input value (e.g. as this issue mentioned, move map -> get center lat/lng -> fill the input for next search)
  • We hope to have some URL GET parameters not directly change by end-user from web interface, but useful for RESTful endpoint
  • As https://www.drupal.org/project/drupal/issues/2455981 mentioned, sometime the exposed operators are too much for end-user, but now we don't have a way to trim it or simplify it (this issue could hide EVERYTHING for this exposed filter)

I also give a try with https://www.drupal.org/project/geofield/issues/3253240 which is functioning only for geofied proximity exposed filter, but it looks too narrow implementation, which could be much better if natively supported by Drupal core.

hswong3i’s picture

Anyway, the newly added "visually_hidden" checkbox is showing, but once click on save and reload the filter setting, the value of "visually_hidden" couldn't be saved correctly...

hswong3i’s picture

Status: Needs work » Closed (outdated)

@Lendude agree that the price performance ratio for this issue is not good enough, where themer could simply set "visibility: hidden" with CSS, so let's keep Drupal core simple stupid ;-)

lendude’s picture

Thanks for reporting back @hswong3i

And thanks for pointing to #2455981: Allow hiding selected operators when exposing filter operators so I could close that, because we landed that feature in #1886018: Make it possible to configure exposed filter operators!