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.
It looks like this is not possible at the moment. Am I right? Are there any plugins, that would allow me to do that?
Is there any interest to commit this if I prepare patch for it?
Comment | File | Size | Author |
---|---|---|---|
#19 | 1315578_save_exposedfilters_d8_19.patch | 2.16 KB | slashrsm |
#18 | 1315578_save_exposedfilters_d8_18.patch | 2.16 KB | slashrsm |
#16 | 1315578_save_exposedfilters_d8_16.patch | 2.09 KB | slashrsm |
#14 | 1315578-save-exposedfilters_13.patch | 2.42 KB | paranojik |
#12 | 1315578_save_exposed_filters_12.patch | 2.09 KB | slashrsm |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedThere's a module that will save exposed filters. I forget its name, though, but if you look around for...hmm. saved searched? saved filters? I forget exactly.
Comment #2
slashrsm CreditAttribution: slashrsm commentedDo you think this module: http://drupal.org/project/views_savefilter ?
I do not if I was clear enough. I am totally happy with default views implementation of exposed filters, when we save selection to $_SESSION. I have problem when I try to use Varnish, since I get session cookie for anonymous users. This makes caching impossible.
I'd like to have ability to save filter values just for registered users. That would allow me to use reverse proxy for anonymous users and to give a bit better experience to registered users.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedOH. Hm.
Indeed those probably should not remember the values for anonymous users in any case. That might actually be considered a bug.
Comment #4
slashrsm CreditAttribution: slashrsm commentedI agree this should not be default and only behaviour, but could be a nice feature from the other hand, IMO.
I think we should allow user to choose which user roles should have their selection saved and which not. My idea is to show another set of checkboxes in UI when "Save selection" checkbox is selected. This would be a list like this:
Does this sound reasonable?
Comment #5
slashrsm CreditAttribution: slashrsm commentedThis is my basic idea how this could work. Logic should be mostly done here, while UI part (form element) should be improved. My idea is to make proposed form a bit more dynamic:
Comment #6
slashrsm CreditAttribution: slashrsm commentedSmall fix in options_definition().
Comment #7
loganfsmyth CreditAttribution: loganfsmyth commentedI just ran into this too when setting up Varnish. I like your solution and I don't see anything obviously wrong with it.
Did you have more that you wanted to do, or should it be set 'needs review' ?
Comment #8
tim.plunkettWhy cast to a string? And if it is necessary, put a space after the (string) cast.
selection, not section, and if this can be reworded to not end in a preposition, that'd be great
missing trailing comma
This doesn't check if the array is empty first, which will throw notices. In addition, there doesn't seem to be a way to know if this value was never set, or if it's purposefully emptied out.
Wouldn't there be no need for the array_values/array_keys functions if array_intersect_key was used instead?
Comment #9
slashrsm CreditAttribution: slashrsm commentedAttached patch is re-roll, as #6 didn't apply any more. I also fixed comments from #8.
I changed Roles to remember section for to User roles. I think this should be explanatory enough. If not, we still have description.
I am now using array_intersect_key(), but array_filter() has to be used before that. It looks like default settings are used, if nothing was configured at all. I changed default settings to mimic current behaviour.
Comment #10
dawehnerIt would be cool if some validation would filter out empty values, so unchecked roles isn't stored. There is options_validate which you can use. Just did that.
Comment #11
paranojik CreditAttribution: paranojik commentedThe patch from #10 does not allow to save the role selection when all values are emptied out. The patch from #9 is OK. I have only rephrased the description and sent user_roles() through check_plain() (as done in core - block.admin.inc).
I think this is RBTC, but someone else should take another look.
Comment #12
slashrsm CreditAttribution: slashrsm commentedLooks OK. I'd rather save for authenticated users only by default. That would be in accordance with #3.
Comment #13
Primsi CreditAttribution: Primsi commentedLooks OK to me.
Comment #14
paranojik CreditAttribution: paranojik commentedRerolled.
Comment #15
dawehnerThe code looks good now. Thanks for all your work, committed to 7.x-3.x
As things got changed it has to be ported.
Comment #16
slashrsm CreditAttribution: slashrsm commentedWhoud this work?
Comment #17
dawehnerD8 uses #states now so this part has to be changed.
Comment #18
slashrsm CreditAttribution: slashrsm commentedLike this?
Comment #19
slashrsm CreditAttribution: slashrsm commentedFixed whitespace.
Comment #20
dawehnerThanks for the port! Committed to 8.x-3.x