Problem/Motivation
Exposed filters currently have a "Limit list to selected items" option, which is fantastic when you have a definite set that that won't change. But if you have an indeterminate or volatile set, you may want to exclude certain items instead. For example, I have an exposed author (user) filter on a table of nodes. I don't want to include the Anonymous user, since only authenticated users can create content in my system; and I don't want to make my root user (Uid 1) username discoverable via autocomplete. I can't hardcode the options, because I may add or remove users over time. What I really want to do is just exclude Anonymous and WhateverMyRootUsernameIs. Does that seem like a feature worth adding? If not, perhaps someone could suggest achieving the functionality in a custom module. Thanks! :)
Steps to reproduce
Proposed resolution
Remaining tasks
Tagged for subsystem maintainer review to determine if this is working as designed per #17.
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | views-add-exclude-selected-items-1828306-18.patch | 2.38 KB | mibfire |
Comments
Comment #1
lendudeMoving to the right issue queue.
Comment #17
johnvYes, you can do this.
Just add an additional non-exposed filter and select 'Is not one of' 'Anonymous'.
(Indeed, the exposed filter might still expose the irrelevant user roles).
I guess this very old issue can be closed.
Comment #18
mibfire commented@johnv
No, what you suggested is not a solution. That is just a half solution. So this ticket shouldn't be closed until this is fixed. I fixed this in a patch that i attached, but to be honest i don't really like how the views works with exposed filter and "Limit list to selected items" checkbox. I mean
because if you have an exposed filter and you select options there this doesn't do anything. This works only if you tick the "Limit list to selected items" checkbox, and this doesn't make any sense. If i select something in the options i would expect to see only these options in the select list. Or this should be other way around when i enable "Limit list to selected items" checkbox then i should see the list that i can select options from.
Either way now I aligned this extra logic to the current one, and there won't be any backward compatibility issue either. But as i said the whole logic should be fixed how the views works now with exposed filter.
Comment #19
mibfire commentedI reopened the issue.
Comment #20
quietone commentedAs far as I can tell the comment in #17 answers this question from the issue summary about how to accomplish the desired filtering. It is not clear to my why that is not sufficient.
So, restoring the feature request category. Also, changes are made on the main development branch, 11.x, so changing version.Also tagging for subsystem maintainer review to determine if this is working by design.
Comment #21
mibfire commented@quietone
@johnv also mentioned why that solution is not sufficient.
So there will be options in the select list that shouldn't be there.