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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RavindraSingh’s picture

Status: Active » Postponed (maintainer needs more info)

Can you please try it with 3..6 release. Seems its not there.

jtwalters’s picture

This still seems to be a bug with negated conditions on Context (all) on 7.x-3.6

jtwalters’s picture

Here'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.

jantoine’s picture

Status: Needs review » Needs work

After applying the patch, a context with a path condition of 'locations' shows up on all 'locations/*' paths as well.

The last submitted patch, 3: exclude_context_all-2233047-3.patch, failed testing.

The last submitted patch, 3: exclude_context_all-2233047-3.patch, failed testing.

The last submitted patch, 3: exclude_context_all-2233047-3.patch, failed testing.

The last submitted patch, 3: exclude_context_all-2233047-3.patch, failed testing.

hass’s picture

Version: 7.x-3.2 » 7.x-3.x-dev
janchojnacki’s picture

Reviewed 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.

janchojnacki’s picture

Status: Needs work » Needs review
andyg8’s picture

Just 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!

hmendes’s picture

Status: Needs review » Reviewed & tested by the community

Worked here and fixed the issue from #4.
Changing to RTBC.

  • paulocs committed 6aa6c14 on 7.x-3.x authored by janchojnacki
    Issue #2233047 by jtwalters, janchojnacki, jantoine, hmendes: Exclude...
paulocs’s picture

Fixed

paulocs’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

DamienMcKenna’s picture