You are here

function _revisioning_revertpublish_revision in Revisioning 8

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

Revert node to selected revision without changing its publication status.

Parameters

object|int $node: Target $node object (loaded with target revision) or nid of target node

int $vid: (optional) vid of revision to revert to, if provided $node must not be an object.

File

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

Code

function _revisioning_revertpublish_revision(&$node, $vid = NULL) {
  $node_revision = is_object($node) ? $node : node_load($node, $vid);
  $return = module_invoke_all('revisionapi', 'pre revert', $node_revision);
  if (in_array(FALSE, $return)) {
    drupal_goto('node/' . $node_revision->nid . '/revisions/' . $node_revision->vid . '/view');
    die;
  }
  _revisioning_revert_revision($node_revision);
  module_invoke_all('revisionapi', 'post revert', $node_revision);
}