function diff_node_view_alter in Diff 7.2
Same name and namespace in other branches
- 7.3 diff.module \diff_node_view_alter()
Implements hook_nodeapi().
File
- ./
diff.module, line 139 - Provides functionality to show a diff between two node revisions.
Code
function diff_node_view_alter(&$build) {
$node = $build['#node'];
if (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');
$old_vid = _diff_get_previous_vid(node_revision_list($node), $node->vid);
// $node->content = array('#value' => diff_inline_show($node, $old_vid));
$build = array(
'#markup' => diff_inline_show($node, $old_vid),
);
}
$build['#prefix'] = isset($build['#prefix']) ? "<div id='diff-inline-{$node->nid}'>" . $build['#prefix'] : "<div id='diff-inline-{$node->nid}'>";
$build['#suffix'] = isset($build['#suffix']) ? $build['#suffix'] . "</div>" : "</div>";
}
}