Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I would like to suggest splitting exposed filters and exposed sort.
Placing sort inside a seperate block or being able to attach it before a view page display. In my opinion this would greatly improve user experience.
Maybe this couid be made optional?
Comments
Comment #1
ferahl CreditAttribution: ferahl commentedWould also like this feature or find out how to do it
Comment #2
tahiticlic CreditAttribution: tahiticlic commented+1 for this functionnality.
In my own use case :
I'll crosspost on Views issues list, since this is more Views related (I tought it was a views issue here...)
Comment #3
tahiticlic CreditAttribution: tahiticlic commentedIn fact, you can separate those blocks quite easily :
Comment #4
deggertsen CreditAttribution: deggertsen commented@tahiticlic Seems like a brilliant solution (thought not so elegant). Is there any chance this would cause any performance issues?
Comment #5
deggertsen CreditAttribution: deggertsen commentedSo I figured out a problem with the "solution" in #3. When one exposed filter is used from one view display and then the other is used from the second display, all of the filters selected from the first display are forgotten in favor of the latter.
Now is appears that this problem is only happening when the sort order or the items per page are changed by one of the exposed filter. As long as you only stick to changing filter criteria it seems like this is working alright. I have tested with and without AJAX enabled and with limited testing it appears that there are more issues with AJAX, but I'm not sure.
Anyways, it would be nice to see this in Views, but it is likely a views issue rather than a Better Exposed Filters issue. I'm looking for potential duplicate issues and I may come back and reassign this issue depending on what I find.
Comment #6
deggertsen CreditAttribution: deggertsen commentedPotential duplicate issues:
#1337580: How to split the exposed filters to separate blocks?
#1420332: How to separate exposed filters and sort? - I like the panels solution used here assuming it works. My initial test has not been successful.
Comment #7
Exploratus CreditAttribution: Exploratus commentedI find the sort exposed filters in views to be very unintuitive. It would be great to be able to split them and have a more traditional exposed search filter, and then a sort filter as a separate block.
Comment #8
berliner CreditAttribution: berliner commentedSee #1337580-9: How to split the exposed filters to separate blocks? for a sandbox module that tries to solve this problem.
Comment #9
mikeker CreditAttribution: mikeker commentedIssue queue cleanup... My apologies for taking so long to address this issue!
Sorry, but this is beyond the scope of BEF. It would be better if Views were to provide separate blocks for each of these items -- then all Views-related modules could benefit from it. And it sounds like there is a possible solution in #8 (thanks for adding that, @berliner!), so I'm closing this as won't fix.
Comment #10
Sander Wemagine CreditAttribution: Sander Wemagine commentedThe solution I used is MultiBlock.
And your done!
Comment #11
jphelan CreditAttribution: jphelan commentedThe mefibs (More exposed forms in blocks) module does this very well.
https://www.drupal.org/project/mefibs
Comment #12
Alejo DHello,
Any solution for this on D9 ? because that approach only works on D7.
Thanks.
Comment #13
aharown07 CreditAttribution: aharown07 as a volunteer commentedThe method in #3 works in D9.
Some further explanation may be helpful. For some of us, this is counterintuitive.
Here's what I just did with one site.
I wanted a search input field on without any sorting, but wanted the sort options included on the search result page only. I already had the search result View created, and two block instances: one for and one for the result page. (Did that because I wanted them in different regions).
But they both included the exposed filter sort options.
(Side note: since I already had a separate instance of the block on in a different region, I'm pretty sure I could have used display: none in the CSS with the right selector to make sort invisible. But since this particular page is likely to see a good bit of traffic, it seems better to not render the sort stuff at all)
Cleared all the caches (maybe not necessary) and tested. At that point I had two blocks on front, so disabled the old one. The new one has no sorting exposed. Search still lands on the same search results page.
I'm sure there's a way to use some kind of "if on front, don't print this sort bit" logic in a twig template, so that's also an option. But I'm more familiar with Views than with twig work.
Comment #14
hongqing CreditAttribution: hongqing commentedThis is exactly what I am looking for. #3 and #13 are the solutions with Drupal 9. More details as below:
1. create a search result page with
FILTER CRITERIA
andSORT CRITERIA
exposed withExposed form in block
:No.2. Duplicate this page. Uncheck
Expose this sort to visitors, to allow them to change it
inSORT CRITERIA
, andExposed form in block
:Yes.3. Place the exposed form from the page duplicated in the block region.