You are here

function diff_inline_show in Diff 6.2

Same name and namespace in other branches
  1. 7.3 diff.pages.inc \diff_inline_show()
  2. 7.2 diff.pages.inc \diff_inline_show()

Show the inline diff for a given node, vid. If vid = 0 or no previous vid exists for the given revision returns the normally rendered content of the specified revision.

2 calls to diff_inline_show()
diff_inline_ahah in ./diff.pages.inc
AHAH callback for rendering the inline diff of a node.
diff_nodeapi in ./diff.module
Implementation of hook_nodeapi().

File

./diff.pages.inc, line 468
Menu callbacks for hook_menu().

Code

function diff_inline_show($node, $vid = 0, $metadata = TRUE) {
  $new_node = $vid ? node_load($node->nid, $vid, TRUE) : drupal_clone($node);
  $new = node_build_content($new_node);
  $new = drupal_render($new->content);
  $old = $vid ? _diff_get_previous_vid(node_revision_list($node), $vid) : 0;
  if ($old) {
    $old = node_build_content(node_load($node->nid, $old, TRUE));
    $old = drupal_render($old->content);
    $output = $metadata ? theme('diff_inline_metadata', $new_node) : '';
    $output .= diff_get_inline($old, $new);
    return $output;
  }
  return $new;
}