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 needed a context which is active when another context ("search_results") is not. I created a new context and added a "Context (all)" condition with one line: "~search_results". That didn't work; the context was not activated on non-search pages. Switching to a "Context (any)" condition with the same configuration, things started to work as expected.
I would expect that "Context (all)" and "Context (any)" work the same if you only enter one line of configuration. Is this a bug, or is there some kind of logic behind this?
Comments
Comment #1
RavindraSingh CreditAttribution: RavindraSingh commentedCan you please try it with 3..6 release. Seems its not there.
Comment #2
jtwalters CreditAttribution: jtwalters commentedThis still seems to be a bug with negated conditions on Context (all) on 7.x-3.6
Comment #3
jtwalters CreditAttribution: jtwalters commentedHere's a patch that supports negated contexts as well. Note: context_all condition is executed during page build hook, so this only works in limited use cases, anyway.
Comment #4
jantoine CreditAttribution: jantoine as a volunteer commentedAfter applying the patch, a context with a path condition of 'locations' shows up on all 'locations/*' paths as well.
Comment #9
hass CreditAttribution: hass commentedComment #10
janchojnacki CreditAttribution: janchojnacki at Exove commentedReviewed the patch jtwalters has submitted. It has issues with wildcard as was mentioned before.
Took a look how it was done for Context (any) plugin and created a patch based on that.
Comment #11
janchojnacki CreditAttribution: janchojnacki at Exove commentedComment #12
andyg8 CreditAttribution: andyg8 commentedJust wondering where this is at? How reliable is the patch in #10? I'm not a coder, but could spend a bit of time testing on a Drupal 7.50 site if that would be helpful.
Thanks for all the good work!
Comment #13
hmendes CreditAttribution: hmendes at CI&T commentedWorked here and fixed the issue from #4.
Changing to RTBC.
Comment #15
paulocsFixed
Comment #16
paulocsComment #18
DamienMcKenna