Views exposed taxonomy filter disappeared

Created on 9 July 2023, over 1 year ago
Updated 3 January 2024, 11 months ago

Twig dump function in the exposed form

After updating my site from Drupal 10.0.9 to Drupal 10.1.0 and then to 10.1.1. Disappeared my views exposed filter. I have custom code in a hook form alter. Change theme, delete code, but no solution came.

Then I installed a new Drupal site, with the steps below. First with version 10.0.9.. no problem. Then with 10.1.0 and 10.1.1. A {{ dump() }} inspection of the view-exposed-form.html.twig yields no results and the exposed form disappears. This only if an exposed filter of type taxonomy term is created. With other filters, not of this type, everything functions normally.

Because this was done in a fresh installation, without any custom code, without any other module, nor themes, I suspect this is a bug. Unfortunately I can't find the solution myself.

Steps to reproduce

  1. Create a vocabulary.
  2. Create a custom content type
  3. Create a view page, with filter criteria to the newly created content type. : Unformatted list, Content: teaser
  4. Create an exposed filter to select the taxonomy terms via multi select. Possibly create other exposed filters that do not refer to a taxonomy term.
  5. Exposed form in a block : yes.
  6. Add the exposed form block to anny region on your page
  7. Add a {{ dump(form) }} function to view-exposed-form.html.twig
🐛 Bug report
Status

Postponed: needs info

Version

10.1

Component
Views 

Last updated about 3 hours ago

Created by

🇧🇪Belgium Belba

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

Comments & Activities

  • Issue created by @Belba
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India shailja179 India

    @Belba,
    This is expected as its already mentioned in views setting. Attaching the screenshot.

    Check this note when you try to put exposed form in block.
    If set, any exposed widgets will not appear with this view.

  • 🇧🇪Belgium Belba

    @shailja179

    Thank you for the answer. I did add the block, with the exposed form to the header of my page. I updated this in the steps. I should have been more clear. The issue persist.

  • 🇮🇳India shailja179 India

    Yes, you can add that form in other part of view(header,footer) as a block. Thats why we need to expose filter in block otherwise it comes above view if we don't expose to block.

  • 🇮🇳India shailja179 India

    Sorry title changed by mistake.

  • Issue was unassigned.
  • Status changed to Active over 1 year ago
  • 🇺🇸United States smustgrave

    Moving to active as there is no patch to review

  • Status changed to Postponed: needs info over 1 year ago
  • 🇳🇱Netherlands Lendude Amsterdam

    Tried the steps to reproduce, my steps:
    * Umami install on 11.x
    * Create node View
    * Add title filter, exposed
    * Expose filters in block
    * Add block to page header => Filter show on every page
    * Add filter on 'Tags', dropdown, exposed, allow multiple
    * Reload page with the filters => Filters still show

    What critical step am I missing to reproduce this?

  • 🇧🇪Belgium Belba

    @Lendude

    Thanks for the follow up.

    The most important step is that there must be a filter of type entity reference(taxonomy) field in the exposed form.

    To save work you can make views of articles and in the filter criteria make a filter on the 'field_tags'. Also create a filter for the titles, as you did in the previous section. The exposed filter is shown! The title of this topic has been edited by another user.

    Then go to the TWIG template responsible for displaying the views exposed form : views-exposed-form.html.twig. Do a {{ dump() }} function to inspect the variables. The result is not displayed, the exposed form disappears.

    Remove the filter from the type entity reference field of the views filter. Everything works as expected. The problem only arises with fields of type entity reference(taxonomy).

    The problem is not there in version 10.0.9. It does in both versions 10.1.0 and 10.1.1.

  • 🇵🇭Philippines bryanmanalo

    Also experiencing this issue. I am surprised that this has not gained a lot of traction. Seems like a big issue for existing sites with lots of views with exposed filters.

  • 🇵🇭Philippines bryanmanalo

    For us the issue was from this particular patch from core: https://www.drupal.org/node/2898635 . When this patch was removed, the filters were back.

    A colleague was able to discover this issue for us.

Production build 0.71.5 2024