You are here

function _diff_get_previous_vid in Diff 7.3

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

Get the entry in the revision list before $vid.

Parameters

array $node_revisions: Array of node revision IDs in descending order.

int $vid: Version ID to look for.

Return value

bool|int Returns FALSE if $vid is the first entry.

4 calls to _diff_get_previous_vid()
diff_diffs_show in ./diff.pages.inc
Create a comparison for the node between versions 'old_vid' and 'new_vid'.
diff_inline_show in ./diff.pages.inc
Show the inline diff for a given node, vid.
diff_node_view_alter in ./diff.module
Implements hook_node_view_alter().
diff_tokens in ./diff.tokens.inc
Implements hook_tokens().

File

./diff.pages.inc, line 595
Menu callbacks for hook_menu().

Code

function _diff_get_previous_vid($node_revisions, $vid) {
  $previous = NULL;
  foreach ($node_revisions as $revision) {
    if ($previous && $previous->vid == $vid) {
      return $revision->vid;
    }
    $previous = $revision;
  }
  return FALSE;
}