You are here

function workflow_update_workflow_transitions in Workflow 7

Given data, insert or update a workflow_transitions.

2 calls to workflow_update_workflow_transitions()
workflow_update_workflows_full_object in ./workflow.features.inc
For use by CRUD only, save everything from the CRUD formed object.
_workflow_admin_ui_update_configured_transitions in workflow_admin_ui/workflow_admin_ui.module
Update the transitions for a workflow.

File

./workflow.module, line 751
Support workflows made up of arbitrary states.

Code

function workflow_update_workflow_transitions(&$data) {
  $data = (object) $data;
  $transition = workflow_get_workflow_transitions_by_sid_target_sid($data->sid, $data->target_sid);
  if ($transition) {
    $roles = explode(',', $transition->roles);
    foreach (explode(',', $data->roles) as $role) {
      if (array_search($role, $roles) === FALSE) {
        $roles[] = $role;
      }
    }
    $transition->roles = implode(',', $roles);
    drupal_write_record('workflow_transitions', $transition, 'tid');
    $data = $transition;
  }
  else {
    drupal_write_record('workflow_transitions', $data);
  }
}