You are here

function diff_node_form_add_changes in Diff 5

Same name and namespace in other branches
  1. 5.2 diff.module \diff_node_form_add_changes()

Callback for node edit form to add the 'Preview changes' output.

1 string reference to 'diff_node_form_add_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 479

Code

function diff_node_form_add_changes($form) {
  global $form_values;
  $op = isset($form_values['op']) ? $form_values['op'] : '';
  if ($op == t('Preview changes')) {
    $node = (object) $form_values;
    $changes = '<table class="diff">';
    $changes .= '<col class="diff-marker" /><col class="diff-content" /><col class="diff-marker" /><col class="diff-content" />';
    $changes .= _diff_table_body(node_load($form_values['nid']), $node);
    $changes .= '</table>';
    $form['#prefix'] = isset($form['#prefix']) ? $changes . $form['#prefix'] : $changes;
  }
  return $form;
}