You are here

function revision_scheduler_test_entity_revision_operation_access in Revision scheduler 7

Implements hook_entity_revision_operation_access().

File

tests/revision_scheduler_test/revision_scheduler_test.module, line 60

Code

function revision_scheduler_test_entity_revision_operation_access($operation, $entity_type, $entity, $account) {
  list($entity_id) = !empty($entity) ? entity_extract_ids($entity_type, $entity) : array(
    NULL,
  );
  switch ($operation['operation']) {
    case 'test_new':
      return empty($entity_id);
    case 'test_existing':
      return !empty($entity_id);
    case 'test_anonymous':
      return empty($account->uid);
  }
}