function workflow_transition_allowed in Workflow 6
Same name and namespace in other branches
- 5.2 workflow.module \workflow_transition_allowed()
- 5 workflow.module \workflow_transition_allowed()
- 6.2 workflow.module \workflow_transition_allowed()
- 7.2 workflow.deprecated.inc \workflow_transition_allowed()
- 7 workflow.module \workflow_transition_allowed()
See if a transition is allowed for a given role.
Parameters
int $tid:
mixed $role: A single role (int or string 'author') or array of roles.
Return value
TRUE if the role is allowed to do the transition.
3 calls to workflow_transition_allowed()
- workflow_admin_ui_transition_grid_form in workflow_admin_ui/
workflow_admin_ui.module - Form builder. Build the grid of transitions for defining a workflow.
- workflow_allowable_transitions in ./
workflow.module - Get allowable transitions for a given workflow state. Typical use:
- workflow_execute_transition in ./
workflow.module - Execute a transition (change state of a node).
File
- ./
workflow.module, line 656 - Support workflows made up of arbitrary states.
Code
function workflow_transition_allowed($tid, $role = NULL) {
$allowed = db_result(db_query("SELECT roles FROM {workflow_transitions} WHERE tid = %d", $tid));
$allowed = explode(',', $allowed);
if ($role) {
if (!is_array($role)) {
$role = array(
$role,
);
}
return array_intersect($role, $allowed) == TRUE;
}
}