You are here

function diff_block in Diff 6.2

Implementation of hook_block().

File

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

Code

function diff_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op === 'list') {
    return array(
      'inline' => array(
        'info' => t('Inline diff'),
      ),
    );
  }
  elseif ($op === 'view' && $delta === 'inline' && user_access('view revisions') && ($node = menu_get_object())) {
    $block = array();
    $revisions = node_revision_list($node);
    if (count($revisions) > 1) {
      $block['subject'] = t('Highlight changes');
      $block['content'] = drupal_get_form('diff_inline_form', $node, $revisions);
    }
    return $block;
  }
}