Exposed filters: Support https://www.drupal.org/project/facets/issues/3396816

Created on 11 December 2023, 12 months ago

When using facets as exposed filters, we should use views_filters_summary instead of our own solution.

Needs work

โœจ Feature request
Status

Active

Version

3.0

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium

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

Comments & Activities

  • Issue created by @StryKaizer
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium

    Patch attached is also required, this is a patch for the views_filters_summary module.

    Once this has been tested, I'll create an issue in the views_filters_summary queue...

  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shyam16102001

    Shyam16102001 โ†’ changed the visibility of the branch 3408001-exposed-filters-support to hidden.

  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States danflanagan8 St. Louis, US

    I applied both patches. I keep seeing this warning:

    Warning: foreach() argument must be of type array|object, string given in Drupal\facets_exposed_filters\Plugin\views\filter\FacetsFilter->acceptExposedInput() (line 141 of modules/contrib/facets/modules/facets_exposed_filters/src/Plugin/views/filter/FacetsFilter.php).

    The text of the pills looks good, but the X links don't seem to be working for me. I'm new to views_filters_summary so I don't know if that is necessarily related to facets.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States brayn7 Lexington, Ky

    This doesn't apply for me with drupal 10.2. Additionally, and I should probably create a ticket for it, but removing a facet selection via the summary just resets all the filters because it is just a link to the view page im currently on. In ViewsExposedFilters.php there is a comment "We don't build real urls here. Views will handle this part for us." But thats not happening. Could be a conflict with ajax maybe idk.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain AntonioDP

    Hello,
    I am using the versions of:
    Drupal: 10.2.4
    Facets: 3.0.x-dev
    View exposed filters summary: 2.0.0-alpha3
    I have installed the VEFS patch fine, the facets patch I had to change it by hand because the code did not match and the summary still does not work and I get this error.
    โ€œTypeError: Illegal offset type in Drupal\Core/Entity/EntityStorageBase->load() (line 263 of /web/core/lib/Drupal/Core/Entity/EntityStorageBase.php).โ€
    From what I've been digging around the $filter->options['facet'] isn't picking up anything and can't create the entity in ViewsFiltersSummary.php.
    I would appreciate any help.
    Thanks in advance

    Translated with DeepL.com (free version)

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium

    Are you using the latest dev version?
    If so, did you run the update script? The views exposed filters part got refactored, and running the update script is required.

    Can you also test if it works on a newly created view?

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium

    I was able to reproduce the issue. The patch for views_filters_summary needs to be updated to work together with current 3.x dev version.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium

    We probably want to include a new processor (Lets enable it by default?) which allows enabled results to be shown, regardless of if they have results or not.

    To cover the case where one facet with 2 items selected in the facet is selected.
    Afterwards a user selects an extra filter in another facet, which only has results for 1 item in the first facet.

    The second checked item in the first facet will in that case be hidden, as there's no result for it anymore. I think many users will prefer to keep it visible, even if there are no items in the resultset matching it anymore.

    This will also ensure all enabled items are always visible in the summary, even if they have no results anymore.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium

    Attached is another approach.

    This ensures all active filters are always visible as facet result, even when they are not relevant anymore (having 0 results).
    This gives for better UX for the enduser, and no patches are required anymore on views_filters_summary

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium StryKaizer Belgium
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024