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.
For authenticated users, we allow exposed filters to be "remembered" when that users returns to that page. We should allow the same for other exposed options such as sort and pager.
D7 version of this feature request: #1157104: remember exposed sort.
Comment | File | Size | Author |
---|---|---|---|
#26 | 2727751-nr-bot.txt | 154 bytes | needs-review-queue-bot |
#5 | views-remember_exposed-2727751-5.patch | 15.48 KB | Tyapchyc |
Comments
Comment #2
mayurjadhav CreditAttribution: mayurjadhav commentedComment #3
dawehnerGood idea!
Comment #4
mikeker CreditAttribution: mikeker as a volunteer commentedComment #5
Tyapchyc CreditAttribution: Tyapchyc commentedComment #6
mikeker CreditAttribution: mikeker as a volunteer commentedLet's see what the testbot says...
Comment #7
mikeker CreditAttribution: mikeker as a volunteer commented@Tyapchyc, thank you for your work on this! I've got a few tweaks I'd like to add from things I was working on over the weekend -- I'll post a patch shortly. Mostly a couple of UI tweaks and and adding the pager offset to the values remembered.
And we'll need some tests for this... Working on those as well.
Comment #9
andypostComment #10
mikeker CreditAttribution: mikeker as a volunteer commentedI spent a fair bit of time this week working on this problem and think that we have a few issues to solve here:
HandlerBase
plugin and not repeated across each of the three (filter, sort, and pager) plugins that implement itHandlerBase
, but not for pager plugins, which extendPluginBase
(viaSqlBase
).Assuming the caching issue (#3) is correct, I feel this issue needs to be postponed until that is resolved. (But I could be completely off-base on this -- as I said it that issue, this intersections of Views, session variables, and cache tags is well above my pay-grade!)
Also, it would be nice to get some feedback from the Views maintainers as to whether code like
\Drupal\views\Plugin\views\filter\FilterPluginBase::storeExposedInput
should really be inHandlerBase
with theFilterBasePlugin
providing the value forisDefaulted()
. And if we can haveSqlBase
extendHandlerBase
instead ofPluginBase
.Otherwise we would have to move all this "remember" code into
PluginBase
, which seems too general for what this entails.Or maybe there's a completely better way to fix this that I'm not seeing?
Comment #15
gooddev CreditAttribution: gooddev commentedAny news on this? Patch is not working with the current Drupal core Version 8.5.3
As a workaround i write my own cookies for sorting and paging and set them in the hook_views_pre_view. Unfortunately this works not with ajax-views because we need the $_GET['page'] parameter.
This is the code:
What I also have to mention is that D8 has some problems with multivalued exposed filters and paging. See related ticket: #2897694: Views pager links incorrectly handle complex exposed filters
There is a patch which should solve the problem, otherwise the workaround is not working.
Comment #20
smustgrave CreditAttribution: smustgrave commentedHello just wondering if anyone has found a solution to this problem with a hook or patch?
Comment #26
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.