Using panels to render a view in one region, while the views exposed filters are rendered as a block in a seperate region, is useful when you want to:
- place your exposed filters somewhere other than the top of the view - where they appear by default
- stay on the same page when using the filters - page url doesn't change just gets appended with the query string
- use your view with a panels page - without being sent to the homepage when filtering
For this example we'll say that we've already created a content type called 'Job listings', which includes a 'location' selection. Our view will render out these 'Job listings', and the exposed filter will let you filter refine by 'location'.
1) Create the view with exposed filters
-
Create a view using the 'Content pane' type of display.
- You can do this by creating a view using: shows 'Content' of type 'Job listing' sorted by 'Newest first'
- When you 'continue & edit' you can add a display type of 'Content pane' by clicking the '+ Add' button under the 'Displays' title
- Set up the 'Fields' to render what you want to show, eg. 'Title' & 'Summary' (provided you're using the fields format).
-
Add your 'Filter Criteria' including the exposed filter, eg 'Published - yes', 'Content type - job listing', 'Location - exposed'
(the exposed filter will be enabled by enabling the 'Expose this filter to visitors, to allow them to change it' checkbox). - Under 'Pane Settings' change 'Use Panel Path' to Yes
- Under 'Advanced' set 'Exposed form in block' to Yes
2) Create your panel page
-
In the main content panel region where you want your results to appear:
'Add content > View panes > View: Job listing' -
in the block region where you want the exposed filters to appear:
'Add content > Views > Exposed form: job_listing-panel_panel_1' - In the settings of your exposed filters block ensure that 'inherit path' is checked
Drupal version:

Justin Chevallier
Avid Drupal site builder & user for +10 years.
Comments
Thanks. I actually had
Thanks. I actually had everything working, but I couldn't find the exposed filter block in Panels. I didn't realize it was being listed under "Exposed form:..."
Why?
"In the settings of your exposed filters block ensure that 'inherit path' is checked."
Why?
Drupal 7 doesn't seem to matter
To be completely honest it doesn't seem to make a difference in D7 (although I have a feeling it did in D6). I've tested with it enabled and disabled and it's the same outcome.
From what I can tell it might be a bug - unless I'm understanding it wrong - as I think that by having 'inhert path' enabled it means that you stay on the same page while the results just get filtered.
For example if you were on a job search page at: http://www.example.com/jobs and then filtered your search it would maintain the /jobs part of the URL and just change to something like http://www.example.com/jobs?jobType=All®ion=20
This helped me a lot.
This helped me a lot. I searched on D.O. and stackexchange and found nothing. Thanks for this simple, well written post.
Thanks!
Thanks! It was easy and very clear.
Add new comment