Document how to have two sets of exposed filters for same view (e.g. header and main page)

Created on 14 August 2020, over 4 years ago
Updated 31 August 2023, over 1 year ago

Problem/Motivation

A Site builder wants 2x search filters on the site.

  • 1x on site header (just text search for example)
  • 1x on search results page (has text search and extra optional filters for example)

Site builder has as no documented way to do this:

Steps to reproduce

Steps tried that seem working.

  • Create a view.
  • Create a "page" display with path /search (display ID "page_1")
  • Edit and add text filter and leave default "no" to exposed filter in a block
  • Create a "page" display with same path /search (display ID "page_exposed")
  • Use the defaults filters from the first display. BUT set "yes" to exposed filter in a block
  • Add exposed filter block to the a header region.
  • Search from exposed filter and you will be redirected :page_1" dispaly of results.

Problems / bugs:

If display IDs are different, we can have different results.

Working:
Page: "page_1" (used on search result page)
Exposed "page_exposed"

NOT working:
Page: "page_1"
Exposed "exposed_page" (used on search result page)

NOT working:
Page: "page_search"
Exposed "exposed_page" (used on search result page)

NOT working:
Page: "page_search"
Exposed "page_exposed" (used on search result page

It seems if "exposed" is first in display ID, it will be used for the result page.
It seems if "page" is first in display ID AND it is page_1, it will be used for the result page but only if the earlier is FALSE.

Order of displays does not seem to have an effect.

Proposed resolution

Documentation page is updated: https://www.drupal.org/docs/8/core/modules/views/expose-a-filter-to-site... β†’

Remaining tasks

N/A

User interface changes

N/A

API changes

Not sure.

Data model changes

Not sure.

Release notes snippet

Not sure.

πŸ“Œ Task
Status

Active

Version

9.5

Component
ViewsΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡¦πŸ‡ΊAustralia silverham

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