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
CommentFileSizeAuthor
#2 view-block.png450.73 KBshailja179

Comments

Belba created an issue. See original summary.

shailja179’s picture

Status: Active » Needs review
StatusFileSize
new450.73 KB

@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.

belba’s picture

Issue summary: View changes
belba’s picture

@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.

cilefen’s picture

Title: Views exposed taxonomy filter » Views exposed taxonomy filter disappeared
shailja179’s picture

Title: Views exposed taxonomy filter disappeared » Views exposed taxonomy filter

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.

shailja179’s picture

Title: Views exposed taxonomy filter » Views exposed taxonomy filter disappeared

Sorry title changed by mistake.

smustgrave’s picture

Assigned: belba » Unassigned
Status: Needs review » Active

Moving to active as there is no patch to review

lendude’s picture

Status: Active » Postponed (maintainer needs more info)

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?

belba’s picture

@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!

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.

bryanmanalo’s picture

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 with taxonomy term reference

bryanmanalo’s picture

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.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

@belba can you add the exact steps you took to the issue summary please.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Wasn't able to replicate this one on D11, so closing out. If still a bug please please reopen.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.