You are here

function diff_inline_show in Diff 7.2

Same name and namespace in other branches
  1. 6.2 diff.pages.inc \diff_inline_show()
  2. 7.3 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_ajax in ./diff.module
AHAH callback for rendering the inline diff of a node.
diff_node_view_alter in ./diff.module
Implements hook_nodeapi().

File

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

Code

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