You are here

function user_rev_diff_inline_form in User Revision 7.2

Form builder: Inline diff controls.

1 string reference to 'user_rev_diff_inline_form'
user_rev_diff_block_view in diff/user_rev_diff.module
Implements hook_block_view().

File

diff/user_rev_diff.module, line 255
Provides functionality to show a diff between two user revisions.

Code

function user_rev_diff_inline_form($form, $form_state, $user, $old_vid, $revisions) {
  $form = array();
  $form['user'] = array(
    '#type' => 'value',
    '#value' => $user,
  );
  $form['revision'] = array(
    '#type' => 'select',
    '#options' => array(
      0 => '< ' . t('No highlighting') . ' >',
    ),
    '#default_value' => arg(2) === 'revisions' && arg(5) === $user->vid ? $old_vid : 0,
    '#ajax' => array(
      'callback' => 'user_rev_diff_inline_ajax',
      'wrapper' => "diff-inline-{$user->uid}",
      'method' => 'replace',
    ),
  );
  foreach ($revisions as $revision) {
    $form['revision']['#options'][$revision->vid] = t('@revision by @name', array(
      '@revision' => format_date($revision->timestamp, 'short'),
      '@name' => $revision->name,
    ));
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('View'),
    '#submit' => array(
      'user_rev_diff_inline_form_submit',
    ),
    '#attributes' => array(
      'class' => array(
        'diff-js-hidden',
      ),
    ),
  );
  return $form;
}