function context_condition_node_taxonomy::execute in Context 6.3
Same name and namespace in other branches
- 6 plugins/context_condition_node_taxonomy.inc \context_condition_node_taxonomy::execute()
- 7.3 plugins/context_condition_node_taxonomy.inc \context_condition_node_taxonomy::execute()
Overrides context_condition_node::execute
File
- plugins/
context_condition_node_taxonomy.inc, line 30
Class
- context_condition_node_taxonomy
- Expose node taxonomy terms as a context condition.
Code
function execute($node, $op) {
if ($this
->condition_used() && !empty($node->taxonomy)) {
foreach ($node->taxonomy as $term) {
foreach ($this
->get_contexts($term->tid) as $context) {
// Check the node form option.
if ($op === 'form') {
$options = $this
->fetch_from_context($context, 'options');
if (!empty($options['node_form'])) {
$this
->condition_met($context, $term->tid);
}
}
else {
$this
->condition_met($context, $term->tid);
}
}
}
}
}