function revisioning_set_node_revision_info in Revisioning 7
Same name and namespace in other branches
- 8 revisioning_api.inc \revisioning_set_node_revision_info()
Set node revision info.
We use this in revisioning_node_load() to set up some useful node properties that may be read later, whether it be in this module or another, thus removing the need for multiple calls in various places to retrieve the same info.
4 calls to revisioning_set_node_revision_info()
- revisioning_condition_revision_is in ./
revisioning.rules.inc - Condition: check revision state.
- revisioning_node_has_pending in ./
revisioning.rules.inc - Condition: check for pending revisions of the node.
- revisioning_node_load in ./
revisioning.module - Implements hook_node_load().
- revisioning_node_presave in ./
revisioning.module - Implements hook_node_presave().
File
- ./
revisioning_api.inc, line 39 - API functions of Revisioning module
Code
function revisioning_set_node_revision_info(&$node) {
if (!isset($node->num_revisions) && isset($node->nid)) {
// We need this info for updated content even if it is not moderated.
// Luckily this info is easily retrieved.
$node->num_revisions = revisioning_get_number_of_revisions($node->nid);
$node->current_revision_id = revisioning_get_current_node_revision_id($node->nid);
$node->is_current = revisioning_revision_is_current($node);
$node->is_pending = _revisioning_node_is_pending($node);
}
// The revision_moderation flag may be overridden on the node edit form by
// users with the "administer nodes" permission. By implication, the 'Publish'
// link needs to be available to those users, for any content with a pending
// revision, as the publish check box on the edit form applies to the current
// rather than the pending revision(s).
if (!isset($node->revision_moderation)) {
$node->revision_moderation = revisioning_content_is_moderated($node->type, $node);
}
// $node->uid and $node->revision_uid were already set in node_load()
// $node->revision is set as part of 'prepare'-op, see node_object_prepare()
}