You are here

function context_node_condition in Context 6.2

Same name and namespace in other branches
  1. 6.3 context.core.inc \context_node_condition()
  2. 7.3 context.core.inc \context_node_condition()

Centralized node condition call function for the ever increasing number of ways to get at a node view / node form.

4 calls to context_node_condition()
context_ctools_render_alter in ./context.core.inc
Implementation of hook_ctools_render_alter().
context_form_alter in ./context.core.inc
Implementation of hook_form_alter().
context_form_alter_node_validate in ./context.core.inc
Node form validation callback.
context_nodeapi in ./context.core.inc
Implementation of hook_nodeapi().

File

./context.core.inc, line 338

Code

function context_node_condition(&$node, $op) {

  // Implementation of context_set_by_condition for node.
  context_set_by_condition('node', $node->type);

  // Implementation of context_set_by_condition for book.
  if (module_exists('book') && isset($node->book)) {
    if ($node->book['menu_name']) {
      context_set_by_condition('book', $node->book['menu_name']);
    }
  }

  // Implementation of context for taxonomy.
  if (module_exists('taxonomy') && is_array($node->taxonomy)) {

    // Set context for terms
    foreach ($node->taxonomy as $term) {
      context_set_by_condition('taxonomy', $term->vid . ':' . $term->tid);
      context_set_by_condition('taxonomy', $term->vid . ':0');
    }
  }
}