You are here

function revision_scheduler_entity_revision_operation_get_info in Revision scheduler 7

Fetch information about entity revision operations.

See also

hook_entity_revision_operation_info()

hook_entity_revision_operation_info_alter()

3 calls to revision_scheduler_entity_revision_operation_get_info()
revision_scheduler_entity_revision_operation_get_options in ./revision_scheduler.module
Fetch the list of available entity revision operation that the user can add.
revision_scheduler_list_page in ./revision_scheduler.pages.inc
revision_scheduler_operation_process in ./revision_scheduler.module
Process a single scheduled revision operation.

File

./revision_scheduler.module, line 567

Code

function revision_scheduler_entity_revision_operation_get_info($entity_type = NULL, $operation = NULL) {
  $operations =& drupal_static(__FUNCTION__);
  if (!isset($operations)) {
    $cid = 'revision:operations:info:' . $GLOBALS['language']->language;
    if ($cache = cache_get($cid)) {
      $operations = $cache->data;
    }
    else {
      $operations = module_invoke_all('entity_revision_operation_info');
      drupal_alter('entity_revision_operation_info', $operations);
      foreach ($operations as &$entity_operations) {
        foreach (array_keys($entity_operations) as $key) {
          $entity_operations[$key]['operation'] = $key;
        }
      }
      cache_set($cid, $operations);
    }
  }
  if (isset($entity_type) && isset($operation)) {
    return isset($operations[$entity_type][$operation]) ? $operations[$entity_type][$operation] : FALSE;
  }
  if (isset($entity_type)) {
    return isset($operations[$entity_type]) ? $operations[$entity_type] : array();
  }
  return $operations;
}