You are here

function context_ui_nodeapi in Context 5

Implementation of hook_nodeapi().

File

context_ui/context_ui.module, line 244

Code

function context_ui_nodeapi(&$node, $op, $teaser, $page) {
  if ($op == 'view' && $page && arg(0) == 'node') {

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

    // Implementation of context_ui_set for book.
    if (module_exists('book') && isset($node->parent)) {

      // @TODO this non-strict check makes me very nervous...
      if ($node->parent == 0) {
        context_ui_set('book', $node->nid);
      }
      else {
        $location = book_location($node);
        if ($location[0]->parent == 0) {
          context_ui_set('book', $location[0]->nid);
        }
      }
    }
  }
}