Would be lovely to use node type conditions with negation.
Example: show title and/or navigation block on all but 1-2 node types.

Doing this "right" would mean another option in context_condition_node.inc
Here's a quick plugin to get the job done, but a real patch would be better.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tr33m4n’s picture

Subscribe, would love to see this for practically all the conditions tbh

grasmash’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.86 KB

Adding option to node condition to allow negation.

grasmash’s picture

doublejosh’s picture

I've been using this in production ever since the patch was posted in 2012.

grasmash’s picture

I'm also using this in production successfully. @doublejosh, please move to RTBC if you agree that patch is reviewed, tested, and ready to be committed.

doublejosh’s picture

Status: Needs review » Reviewed & tested by the community

Done.

doublejosh’s picture

FileSize
3.3 KB

Here's a more recent version that fires more widely. Because views and other callback pages are also not that given node type.

doublejosh’s picture

Status: Reviewed & tested by the community » Needs work

I take it back, the negation code listed here is not working as intended. Should be a smart fix though.

grasmash’s picture

@doublejosh Can you be more specific? Is the patch in #3 not working? In what way?

grasmash’s picture

Status: Needs work » Needs review

I'm moving this back to 'Needs Review' because I cannot reproduce the issue referenced by @doublejosh.

jantoine’s picture

I was able to reproduce @doublejosh's issue by trying to have a context active on a non-node page using the negation functionality. This doesn't work is because the context_node_condition() is invoked from hook_node_view() and hook_form_alter(), so it's only fired when a node is being viewed/edited. The attached patch moves the invocation from hook_node_view() and hook_node_alter() to hook_init() where many other context conditions are invoked from.

Status: Needs review » Needs work

The last submitted patch, 11: context-node_negate-1589162-11.patch, failed testing.

The last submitted patch, 11: context-node_negate-1589162-11.patch, failed testing.

The last submitted patch, 11: context-node_negate-1589162-11.patch, failed testing.

The last submitted patch, 11: context-node_negate-1589162-11.patch, failed testing.