You are here

function user_rev_diff_block_view in User Revision 7.2

Implements hook_block_view().

File

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

Code

function user_rev_diff_block_view($delta) {
  $block = array();
  if ($delta === 'inline' && variable_get('show_user_rev_diff_inline', FALSE) && ($vid_arg = user_revision_vid_arg()) && _user_revision_access($user = menu_get_object('user'), array(
    'view user revisions',
    'view own user revisions',
  ))) {
    $vid = arg($vid_arg);
    $user_rev = user_revision_load($user->uid, $vid);
    $revisions = user_revision_list($user_rev);
    if (count($revisions) > 1) {
      unset($revisions[$vid]);
      $old_vid = arg(++$vid_arg);
      $block['subject'] = t('Highlight changes');
      $block['content'] = drupal_get_form('user_rev_diff_inline_form', $user_rev, $old_vid, $revisions);
    }
  }
  return $block;
}