You are here

function _block_revisions_access in Block Revisions 7

Same name and namespace in other branches
  1. 6 block_revisions.module \_block_revisions_access()

Access callback for the revisions tab.

Revisions are only supported for custom blocks ($module = 'block'), so deny access to hide the tab for other types of blocks.

@todo: only show the revisions tab when there is more than one revision, similar to node.module revisions.

1 string reference to '_block_revisions_access'
block_revisions_menu in ./block_revisions.module
Implements hook_menu().

File

./block_revisions.module, line 65

Code

function _block_revisions_access($module, $delta) {
  if ($module !== 'block') {
    return FALSE;
  }
  $revision_count = db_query('SELECT count(vid) FROM {boxes_revisions} WHERE bid = :bid', array(
    ':bid' => $delta,
  ))
    ->fetchField();
  return user_access('administer blocks') && $revision_count >= 1;
}