You are here

function diff_node_form_build_preview_changes in Diff 6.2

Same name and namespace in other branches
  1. 6 diff.module \diff_node_form_build_preview_changes()
  2. 7.3 diff.module \diff_node_form_build_preview_changes()
  3. 7.2 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
Implementation of hook_form_alter().

File

./diff.module, line 197
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');
  $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, variable_get('remove_markup_default_' . $node->type, FALSE));
  $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;
}