function diff_node_form_build_preview_changes in Diff 7.2
Same name and namespace in other branches
- 6.2 diff.module \diff_node_form_build_preview_changes()
- 6 diff.module \diff_node_form_build_preview_changes()
- 7.3 diff.module \diff_node_form_build_preview_changes()
Callback if 'View changes' is pressed.
1 string reference to 'diff_node_form_build_preview_changes'
- diff_form_alter in ./
diff.module - Implements hook_form_alter().
File
- ./
diff.module, line 215 - Provides functionality to show a diff between two node revisions.
Code
function diff_node_form_build_preview_changes($form, &$form_state) {
module_load_include('inc', 'diff', 'diff.pages');
$old_node = clone node_load($form_state['values']['nid']);
$node = node_form_submit_build_node($form, $form_state);
// Create diff of old node and edited node
$rows = _diff_body_rows($old_node, $node, variable_get('remove_markup_default_' . $node->type, FALSE));
$cols = _diff_default_cols();
$header = _diff_default_header();
$changes = theme('diff_table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'class' => 'diff',
),
'cols' => $cols,
));
// Prepend diff to edit form
$form_state['node_preview'] = $changes;
$form_state['rebuild'] = TRUE;
}