You are here

function revisioning_revisionapi in Revisioning 8

Same name and namespace in other branches
  1. 6.4 revisioning_api.inc \revisioning_revisionapi()
  2. 6.3 revisioning_api.inc \revisioning_revisionapi()
  3. 7 revisioning_api.inc \revisioning_revisionapi()

Implements hook_revisionapi().

Act on various revision events.

"Pre" operations can be useful to get values before they are lost or changed, for example, to save a backup of revision before it's deleted. Also, for "pre" operations vetoing mechanics could be implemented, so it would be possible to veto an operation via hook_revisionapi(). For example, when the hook is returning FALSE, operation will be vetoed.

File

./revisioning_api.inc, line 253
API functions of Revisioning module

Code

function revisioning_revisionapi($op, $node) {
  switch ($op) {
    case 'post update':
      if (module_exists('rules')) {
        rules_invoke_event('revisioning_post_update', $node);
      }
      break;
    case 'pre publish':
      if (module_exists('rules')) {
        rules_invoke_event('revisioning_pre_publish', $node);
      }
      break;
    case 'post publish':

      // Called from _revisioning_publish_revision.
      // Invoke hook_revision_publish() triggers, passing the node as argument.
      module_invoke_all('revision_publish', $node);
      if (module_exists('rules')) {
        rules_invoke_event('revisioning_post_publish', $node);
      }
      break;
    case 'post unpublish':

      // Called from _revisioning_unpublish_revision().
      // Invoke hook_revision_unpublish triggers passing the node as an arg.
      module_invoke_all('revision_unpublish', $node);
      if (module_exists('rules')) {
        rules_invoke_event('revisioning_post_unpublish', $node);
      }
      break;
    case 'pre revert':
      if (module_exists('rules')) {
        rules_invoke_event('revisioning_pre_revert', $node);
      }
      break;
    case 'post revert':

      // Called from revisioning_revert_confirm_post_submit().
      // Invoke hook_revision_revert() triggers passing the node as an arg.
      module_invoke_all('revision_revert', $node);
      if (module_exists('rules')) {
        rules_invoke_event('revisioning_post_revert', $node);
      }
      break;
    case 'pre delete':
      if (module_exists('rules')) {
        rules_invoke_event('revisioning_pre_delete', $node);
      }
      break;
    case 'post delete':
      break;
  }
}