function diff_node_form_build_preview_changes in Diff 6
Same name and namespace in other branches
- 6.2 diff.module \diff_node_form_build_preview_changes()
- 7.3 diff.module \diff_node_form_build_preview_changes()
- 7.2 diff.module \diff_node_form_build_preview_changes()
Callback if 'Preview changes' is pressed.
1 string reference to 'diff_node_form_build_preview_changes'
- diff_form_alter in ./
diff.module - Implementation of hook_form_alter(). Used to add a 'Preview changes' button on the node edit form.
File
- ./
diff.module, line 480 - Provides functionality to show a diff between two node revisions.
Code
function diff_node_form_build_preview_changes($form, &$form_state) {
$node = node_form_submit_build_node($form, $form_state);
// Create diff of old node and edited node
$rows = _diff_body_rows(node_load($form_state['values']['nid']), $node);
$cols = _diff_default_cols();
$header = _diff_default_header();
$changes = theme('diff_table', $header, $rows, array(
'class' => 'diff',
), NULL, $cols);
// Prepend diff to edit form
$form_state['node_preview'] = isset($form_state['node_preview']) ? $changes . $form_state['node_preview'] : $changes;
}