function workflow_update_transitions in Workflow 5.2
Same name and namespace in other branches
- 5 workflow.module \workflow_update_transitions()
- 6.2 workflow.module \workflow_update_transitions()
- 6 workflow.module \workflow_update_transitions()
Update the transitions for a workflow.
Parameters
array $transitions: Transitions, for example: 18 => array( 20 => array( 'author' => 1, 1 => 0, 2 => 1, ) ) means the transition from state 18 to state 20 can be executed by the node author or a user in role 2. The $transitions array should contain ALL transitions for the workflow.
1 call to workflow_update_transitions()
File
- ./
workflow.module, line 1241
Code
function workflow_update_transitions($transitions = array()) {
// Empty string is sometimes passed in instead of an array.
if (!$transitions) {
return;
}
foreach ($transitions as $from => $to_data) {
foreach ($to_data as $to => $role_data) {
foreach ($role_data as $role => $can_do) {
if ($can_do) {
workflow_transition_add_role($from, $to, $role);
}
else {
workflow_transition_delete_role($from, $to, $role);
}
}
}
}
db_query("DELETE FROM {workflow_transitions} WHERE roles=''");
}