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.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | context-node_negate-1589162-11.patch | 5.92 KB | jantoine |
Comments
Comment #1
tr33m4n commentedSubscribe, would love to see this for practically all the conditions tbh
Comment #2
grasmash commentedAdding option to node condition to allow negation.
Comment #3
grasmash commentedComment #4
doublejosh commentedI've been using this in production ever since the patch was posted in 2012.
Comment #5
grasmash commentedI'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.
Comment #6
doublejosh commentedDone.
Comment #7
doublejosh commentedHere's a more recent version that fires more widely. Because views and other callback pages are also not that given node type.
Comment #8
doublejosh commentedI take it back, the negation code listed here is not working as intended. Should be a smart fix though.
Comment #9
grasmash commented@doublejosh Can you be more specific? Is the patch in #3 not working? In what way?
Comment #10
grasmash commentedI'm moving this back to 'Needs Review' because I cannot reproduce the issue referenced by @doublejosh.
Comment #11
jantoine commentedI 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.