You are here

function context_node_node_view in Context Node 7

Implements hook_node_view()

File

./context_node.module, line 273

Code

function context_node_node_view($node, $view_mode, $langcode) {
  $option = variable_get("context_node_default_" . $node->type, '');
  if ($option == "none" || empty($option)) {
    return;
  }
  else {
    if (isset($node->context)) {
      if ($node->context == "none" || empty($node->context) || $node->context == "default") {
        return;
      }

      // Load the context
      $context = context_load($node->context);

      // Set the context
      context_set('context', "context_node", $context);
    }
  }
}