You are here

function diff_form_alter in Diff 7.2

Same name and namespace in other branches
  1. 5.2 diff.module \diff_form_alter()
  2. 5 diff.module \diff_form_alter()
  3. 6.2 diff.module \diff_form_alter()
  4. 6 diff.module \diff_form_alter()

Implements hook_form_alter().

File

./diff.module, line 157
Provides functionality to show a diff between two node revisions.

Code

function diff_form_alter(&$form, &$form_state, $form_id) {
  if (!empty($form['#node_edit_form'])) {

    // Add a 'View changes' button on the node edit form.
    if (variable_get('show_preview_changes_' . $form['type']['#value'], TRUE) && $form['nid']['#value'] > 0) {
      $form['actions']['preview_changes'] = array(
        '#type' => 'submit',
        '#value' => t('View changes'),
        '#weight' => 12,
        '#submit' => array(
          'diff_node_form_build_preview_changes',
        ),
      );
    }
  }
}