You are here

function diff_inline_form in Diff 6.2

Same name and namespace in other branches
  1. 7.3 diff.module \diff_inline_form()
  2. 7.2 diff.module \diff_inline_form()

Form builder: Inline diff controls.

1 string reference to 'diff_inline_form'
diff_block in ./diff.module
Implementation of hook_block().

File

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

Code

function diff_inline_form($form_state, $node, $revisions) {
  $form = array();
  $form['node'] = array(
    '#type' => 'value',
    '#value' => $node,
  );
  $form['revision'] = array(
    '#type' => 'select',
    '#options' => array(
      0 => '< ' . t('No highlighting') . ' >',
    ),
    '#default_value' => arg(2) === 'revisions' && arg(3) === $node->vid ? $node->vid : 0,
    '#ahah' => array(
      'path' => "node/{$node->nid}/revisions/diff-inline",
      'wrapper' => "diff-inline-{$node->nid}",
      'method' => 'replace',
    ),
  );
  foreach ($revisions as $revision) {
    $form['revision']['#options'][$revision->vid] = t('@revision by @name', array(
      '@revision' => format_date($revision->timestamp, 'small'),
      '@name' => $revision->name,
    ));
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('View'),
    '#submit' => array(
      'diff_inline_form_submit',
    ),
    '#attributes' => array(
      'class' => 'diff-js-hidden',
    ),
  );
  return $form;
}