Active
Project:
Context
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Sep 2009 at 14:29 UTC
Updated:
29 Jun 2017 at 12:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
garywiz commentedWe have this exact problem, and it's getting worse the more we use Context (but we love Context! reallly we do)
The ....OR....OR...OR... nature of context sometimes makes contexts SO inclusive that it is hard to create some specific contexts.
I think some kind of "processing order" or "weighting" may help. We have this problem not just with paths, but also with nodes:
* Include nodetype1 nodetype2, etc.
* EXCEPT on the home page, or another page, etc.
The idea of NEGATIVE conditions for contexts seems very very appealing to me across the board.
I am about to upgrade from beta4 to beta7, maybe some changes have taken place, but if not, the more contexts you start using, the more necessary it is to be able to have a "NOT" operator somewhere. My fear is it may complicate the interface.
What really is needed is something akin to "Rules" where you can add a condition and specify an order of conditions, along with "not" operators for each. So, having a context triggered by a list of conditions would make much more sense than the current "any of the following" interface.
Comment #2
frankcarey commentedThis work might make it easier to have more fine grained control using rules. #591114: Rules integration
Comment #3
gregglesSubscribe (this is code and UI, but mostly code, IMO)
Comment #4
tanc+1 for the concept of negative conditions or a 'NOT' operator (Ideally in version 6.x-3.0).
Comment #5
tancyhahn or jmiccolis, any thoughts on NOT operators?
Comment #6
yhahn commentedI'll think about this but atm I don't think this will be implemented in any kind of generalized way. It may make more sense on a per-condition plugin basis, e.g. path (with an additional field for excluded paths).
Comment #7
steve_uk commentedAny further thoughts on this? I'm using Context to replace the block visibility options and would be grateful to see an option to exclude paths
Comment #8
vkr11 commented+1 to negate. Even a path exclude would be great !!
Comment #9
frankcarey commentedhas anyone looked at #2? It's been working really well for us. You can just make a rule that fires when a context is set, and then unset or change the context based on other rules conditions.
Comment #10
yhahn commentedMoving versions up. Will think more about this.
Comment #11
finex commentedsubscribing
Comment #12
c4rl commentedSubscribe
Comment #13
chriscalip commentedsubscribe
note-to-self: context/block assignments finally adding the option of excluding certain paths. good stuff.
Comment #14
chriscalip commentedNeeded this for a project of mine, and it looks like a few folks also need this functionality. The attached file contains the module negate_path, a context conditional plugin module. It gives users the option to add a condition "Show on every page except the listed pages." enjoy.
Comment #15
aufumy commentedthanks chriscalip, works for me.
Here it is as a patch file.
Comment #16
aleksey.tk commentedThanks for the module, chriscalip, works fine for us, you have saved us a lot of time!
P.S. Also thanks for the nice piece of Drupal humour :D
// $Id: negate_path.module,v get_er_done help_i_dont_want_to_maintain_modules
Comment #17
donquixote commentedsubscribe..
i would like to exclude admin
Comment #18
tim.plunkettThe context_extras module now has the "negate path" plugin, and I just submitted a "negate taxonomy" plugin over at #847312: Additions to the module because I needed it for a site build.
yhahn, I know you said you didn't think there would be a general negate option for each field, but I really think that it is worth reconsidering. I can easily see the use cases for it, and it would stop me from writing an inverse plugin for every plugin in context :)
Comment #19
tim.plunkett#813954: Path exclusion and active context condition can be used as a very specific inverse context.
It only passes if no other contexts have passed.
Comment #20
q0rban commentedSubscribe
Comment #21
yhahn commentedComment #22
yhahn commentedSee http://drupal.org/node/813954#comment-3267016 for excluded paths and contexts.
I'm not sure about negation for every single condition before 3.x stable. Definitely something to consider down the road.
Comment #23
rokrA generalized way would be great. At this moment i need a way to display a block for authenticated users who don't have a specific role. (It is an apply for that role link).
so +1, rokr :-)
Comment #24
mparker17+1. This would be really really useful for me!
Comment #25
pixelsweatshop commentedsubscribe
Comment #26
doublejosh commentedListening. Would love this especially for roles. Want some menus for all users except a certain role.
Comment #27
yesct commentedi need it for a role too. I want to show a block for only users who dont have a certain role.
I'm using inline css to hide taxonomy term links for all users who are not admins.
Comment #28
dddbbb commented+1
Comment #29
damienmckennaFYI, in case you missed it (as I had) you can negate paths by adding a tilde in front of it, e.g. if you want to match everything except for "admin" you'd set the path value to
~adminComment #30
dddbbb commentedThat's excellent news - how'd I miss that? Perhaps this needs to be made a little clearer?
Comment #31
pixelsweatshop commentedHow about ~ ? Say for sitewde context?
Comment #32
joachim commented> FYI, in case you missed it (as I had) you can negate paths by adding a tilde in front of it, e.g. if you want to match everything except for "admin" you'd set the path value to ~admin
This really needs to be in the UI, and there's no reason to postpone that at least.
Comment #33
mparker17Maybe this is the wrong issue, but I would be interested in having a "negate" checkbox for every condition, not just the paths.
Comment #34
nlambert commentedGlad I read this!
Actually, this already seems to be in the UI. I'm using rubik and when I hover over the path field I can see the following help text :
However, the font makes the tilde look like a minus (-) ... or maybe its my eyes.
Cheers
Comment #35
djroshi commented+1 for negating role condition
Comment #36
doublejosh commentedThis is actually possible, though not optimal... You can add a context condition and negate it.
So create your content type context or whatever, then create a second context for a role (eg: user_trial)
Then have the first context have a context condition with ~user_trial.
This does lead to some needless context bloat, but it will get the job done.
Comment #37
djroshi commentedThat's awesome :)
Comment #38
pixelsweatshop commentedComment #39
q0rban commentedPlease leave this feature request open until there's a generalized solution for negating conditions.
Comment #40
kevinquillen commentedHow can I negate a context if you receive a 403 error?
Comment #41
yareckon commentedsee also #1195192: Document or fix context negation not working recursively.
Comment #42
cfbauer commentedI don't think the language is very clear. Here's what it says:
It says to use the ~ character to exclude paths, but it doesn't say how your'e supposed to do that. It would be better if the text read like this or similar:
Comment #43
dsim commentedThanks cfbauer. It saves my time.
Comment #44
AlessMascherpa commentedYou can do many things like this one with http://drupal.org/project/context_rules
Cheers
Alessandro Mascherpa
Comment #45
escoles commentedIt's all well and good that you can negate paths, but what about other kinds of conditions?
E.g., I have a need to perform an action whenever the user agent indicates that the browser is NOT IE 6, 7 or 8. That's actually really, really hard to do if you can't just create a positive matching condition and negate it.
So I think this is kind of an important feature. Without it, working with Context often feels like trying to program a Register Machine.
Comment #46
joachim commentedRather than create a second version of every plugin, would it be possible for Context core to add a negate option itself at the bottom of each plugin's form, and that way every plugin is automatically negatable?
Comment #47
markdc+1 for negate roles
Comment #48
jantoine commentedComment #49
jantoine commentedComment #50
anybodyI can confirm this issue is very very important... how can we proceed here?
Comment #51
giupenni commented+1
Comment #52
delacosta456 commentedhi
please is it possible to extend this patch(for numeric values to ) for more option like :
Not equal to
Less than
greater than
etcc...
Comment #53
anybodyNo, please create a separate issue for that with further information about which condition is meant. This is just about boolean negation!