Allow exposed filters to also be rendered in view when exposed as block

Created on 27 November 2017, almost 7 years ago
Updated 4 May 2023, over 1 year ago

Problem/Motivation

There has been several times when I've had the need to expose filters in a block so that they can be placed on a separate page but then also having the exposed filters displayed on the actual view page.

This could possibly be resolved by also placing the same exposed block on the views page but in some cases this creates problems where you need the view and exposed filters in the same template file to be able to create meaningful and useful markup.

Proposed resolution

The proposed resolution is to allow views to also render the exposed filters in the view when exposed as a block by adding a checkbox that becomes visible when "Yes" has been selected in the "Expose form in block" dialogue.

Remaining tasks

  • Code needs review

User interface changes

There is a new checkbox on the "Put the exposed form in a block" view dialogue that is shown when "Yes" is selected as an option that lets you also keep the filters rendered in the view.

API changes

No API-changes were made, some of the views code related to adding the exposed variable was slightly re-written to have better readability.

Other

I've provided a patch that does the job but it would be great if someone could review it and comment if there are things that might need to be changed or improved upon.

I had major problems getting the tests to run properly so i have not run the tests but i did add a new test that tests the new exposed filter option that hopefully works.

Feature request
Status

Needs work

Version

10.1

Component
Views 

Last updated about 9 hours ago

Created by

🇸🇪Sweden NormySan

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