You are here

function diff_nodeapi in Diff 6.2

Implementation of hook_nodeapi().

File

./diff.module, line 131
Provides functionality to show a diff between two node revisions.

Code

function diff_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($page && $op == 'view' && user_access('view revisions') && variable_get('show_diff_inline_' . $node->type, FALSE)) {

    // Ugly but cheap way to check that we are viewing a node's revision page.
    if (arg(2) === 'revisions' && arg(3) === $node->vid) {
      module_load_include('inc', 'diff', 'diff.pages');
      $node->content = array(
        '#value' => diff_inline_show($node, $node->vid),
      );
    }
    $node->content['#prefix'] = isset($node->content['#prefix']) ? "<div id='diff-inline-{$node->nid}'>" . $node->content['#prefix'] : "<div id='diff-inline-{$node->nid}'>";
    $node->content['#suffix'] = isset($node->content['#suffix']) ? $node->content['#suffix'] . "</div>" : "</div>";
  }
}