function revisioning_revisionapi in Revisioning 6.4
Same name and namespace in other branches
- 8 revisioning_api.inc \revisioning_revisionapi()
- 6.3 revisioning_api.inc \revisioning_revisionapi()
- 7 revisioning_api.inc \revisioning_revisionapi()
Implementation of hook_revisionapi().
Act on various revision events.
@TODO: Add more operations if needed.
Parameters
$op: Operation
$node: Node of current operation (loaded with vid of the operation).
"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 81 - API functions of Revisioning module
Code
function revisioning_revisionapi($op, $node) {
switch ($op) {
case 'pre revert':
// Invoke corresponding Rules event
if (module_exists('rules')) {
rules_invoke_event('revisioning_pre_revert', $node);
}
break;
case 'post revert':
// Invoke the revisioning trigger passing 'revert' as the operation
if (module_exists('trigger')) {
module_invoke_all('revisioning', 'revert', $node);
}
// Invoke corresponding Rules event
if (module_exists('rules')) {
rules_invoke_event('revisioning_post_revert', $node);
}
break;
case 'pre publish':
// Invoke corresponding Rules event
if (module_exists('rules')) {
rules_invoke_event('revisioning_pre_publish', $node);
}
break;
case 'post publish':
// Invoke the revisioning trigger passing 'publish' as the operation
if (module_exists('trigger')) {
module_invoke_all('revisioning', 'publish', $node);
}
// Invoke corresponding Rules event
if (module_exists('rules')) {
rules_invoke_event('revisioning_post_publish', $node);
}
break;
//case 'pre unpublish':
// Not implemented: do we really need it ?
case 'post unpublish':
// Invoke the revisioning trigger passing 'unpublish' as the operation
if (module_exists('trigger')) {
module_invoke_all('revisioning', 'unpublish', $node);
}
// Invoke corresponding Rules event
if (module_exists('rules')) {
rules_invoke_event('revisioning_post_unpublish', $node);
}
break;
case 'pre delete':
// Invoke corresponding Rules event
if (module_exists('rules')) {
rules_invoke_event('revisioning_pre_delete', $node);
}
break;
case 'post delete':
break;
}
}