function state_flow_revisions_node_tab_access in State Machine 7.3
Disable Revisions tab if there are no state flow changes.
From Views, it's not possible for performance reasons. But here, with a lightweight query, we can predict if it would have results or not.
1 string reference to 'state_flow_revisions_node_tab_access'
- state_flow_menu_alter in modules/
state_flow/ state_flow.module - Implements hook_menu_alter().
File
- modules/
state_flow/ state_flow.module, line 128 - An implementation of node revision workflow for Drupal based on the State Machine system.
Code
function state_flow_revisions_node_tab_access() {
// The menu_get_object() would cause infinite recursion.
$nid = (int) arg(1);
$count = db_query("SELECT COUNT(*) FROM {state_flow_states} WHERE entity_type = 'node' and entity_id = :nid", array(
':nid' => $nid,
))
->fetchField();
if ($count > 0) {
$args = func_get_args();
$callback = isset($args[0][0]) && is_callable($args[0][0]) ? $args[0][0] : 'views_check_perm';
$params = isset($args[0][1]) ? $args[0][1] : array(
'administer nodes',
);
return call_user_func_array($callback, $params);
}
return FALSE;
}