You are here

function revision_scheduler_entity_revision_operation_get_options in Revision scheduler 7

Fetch the list of available entity revision operation that the user can add.

4 calls to revision_scheduler_entity_revision_operation_get_options()
RevisionSchedulerFunctionalTestCase::testNodeRevisionScheduling in tests/RevisionSchedulerFunctionalTestCase.test
revision_scheduler_edit_form in ./revision_scheduler.pages.inc
revision_scheduler_operation_access in ./revision_scheduler.module
revision_scheduler_operation_create_access in ./revision_scheduler.module
Load a single entity with an optional revision ID.

File

./revision_scheduler.module, line 632

Code

function revision_scheduler_entity_revision_operation_get_options($entity_type, $entity = NULL, $account = NULL) {
  $options =& drupal_static(__FUNCTION__, array());
  if (!isset($account)) {
    $account = $GLOBALS['user'];
  }
  $cid = md5(serialize(array(
    $entity_type,
    $entity,
    $account,
  )));
  if (!isset($options[$cid])) {
    $options[$cid] = array();
    $operations = revision_scheduler_entity_revision_operation_get_info($entity_type);
    foreach ($operations as $key => $operation) {
      if (_revision_scheduler_operation_access($operation, $entity_type, $entity, $account)) {
        $options[$cid][$key] = $operation['label'];
      }
    }
  }
  return $options[$cid];
}