function _workbench_moderation_access_current_draft in Workbench Moderation 7.2
Same name and namespace in other branches
- 7.3 workbench_moderation.module \_workbench_moderation_access_current_draft()
- 7 workbench_moderation.module \_workbench_moderation_access_current_draft()
Checks if the user can view the current node revision.
This is the access callback for node/%node/draft as defined in workbench_moderation_menu(). The user has access if the loaded node is the active revision and the active revision isn't the published one.
Parameters
int $node: The node being acted upon.
Return value
bool Booelan TRUE or FALSE.
1 string reference to '_workbench_moderation_access_current_draft'
- workbench_moderation_menu in ./
workbench_moderation.module - Implements hook_menu().
File
Code
function _workbench_moderation_access_current_draft($node) {
$active_id = state_flow_entity_get_active_revision_id($node, 'node');
$machine = state_flow_entity_load_state_machine($node, 'node');
// Empty active ID means that it is a node that never before was handled by
// moderation so it's most likely an published version and not a draft.
// If the loaded node has't the same revision id as the active revision id we
// skip further checks too.
if (empty($active_id) || $machine
->isActivePublishedRevision()) {
return FALSE;
}
return state_flow_menu_node_access($node);
}