You are here

function node_diff in Diff 5

Same name and namespace in other branches
  1. 5.2 node.inc \node_diff()
  2. 6.2 includes/node.inc \node_diff()
  3. 6 node.inc \node_diff()
  4. 7.2 includes/node.inc \node_diff()

Implementation of hook_diff() for node.module (body and title).

File

./node.inc, line 6

Code

function node_diff(&$old_node, &$new_node) {
  $result = array();
  $type = node_get_types('type', $new_node);
  $result[] = array(
    'name' => $type->title_label,
    'old' => array(
      $old_node->title,
    ),
    'new' => array(
      $new_node->title,
    ),
    'format' => array(
      'show_header' => false,
    ),
  );
  if ($type->has_body) {
    $result[] = array(
      'name' => $type->body_label,
      'old' => explode("\n", $old_node->body),
      'new' => explode("\n", $new_node->body),
    );
  }
  return $result;
}