Problem/Motivation

When you have 2 (or more) blocks between which you can switch and you have exposed filters on these blocks, applying the filters forgets the 'mode' query paramater. Because of this, the website "forgets" which display should be shown.

Steps to reproduce

  1. Add two block displays: Block 1 and Block2
  2. Add a display switch from this module in the display's header
  3. Put Block 1 on a page
  4. Click the link to switch to Block 2
  5. Apply a filter
  6. The page refreshes and Block 1 is shown again

Proposed resolution

Make sure the query parameter 'mode' is not forgotten.

Remaining tasks

User interface changes

N/A

API changes

Data model changes

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

Stefdewa created an issue. See original summary.

stefdewa’s picture

Assigned: stefdewa » Unassigned
Status: Active » Needs review

Added an MR which is based on the "facets" login in search_api ( https://git.drupalcode.org/project/search_api/-/blob/8.x-1.x/search_api.... ). A hidden field is added to the exposed form containing the mode.

stefdewa’s picture

More background information:

This patch would not be needed if the core issue #2681953: Allow exposed form to preserve URL query parameters is resolved. Then you could configure the view to retain the 'mode' query parameter.
Additionally, if you use better_exposed_filters, you also need the patch from better_exposed_filters issue #3119947: Allow exposed form to preserve URL query parameters .

luksak’s picture

Status: Needs review » Closed (works as designed)

@Stefdewa Thank you for the issue and the MR!

I'm a bit unsure about how we should handle this, since there is an existing issue against core. I'd prefer not to commit this, since this is not an issue of this module. Do you agree?

joco_sp’s picture

I have the same problem.
The patch mentioned in the #4 for the core didn't work for me, so I tried the solution from this MR and it solved the issue.
Thank you @Stefdewa :)

luksak’s picture

Status: Closed (works as designed) » Active
Related issues: +#2681953: Allow exposed form to preserve URL query parameters

@Stefdewa can you confirm this?

stefdewa’s picture

At the time that I created this issue, the problem was resolved for me when I used the two patches from #4. I agree that you don't include the patch I created because the problem should be solved upsteam. User joco_sp can still use the patch here if the patches didn't work for him for some reasen. I would keep this issue 'Closed' and wait until at least the core issue is resolved. Then, test again and reevaluate.

luksak’s picture

Status: Active » Closed (works as designed)

Ok, thank you for your feedback!