You are here

function workflow_create in Workflow 5.2

Same name and namespace in other branches
  1. 5 workflow.module \workflow_create()
  2. 6.2 workflow.module \workflow_create()
  3. 6 workflow.module \workflow_create()
  4. 7.2 workflow.entity.inc \workflow_create()

Create a workflow and its (creation) state.

Parameters

$name: The name of the workflow.

1 call to workflow_create()
workflow_add_form_submit in ./workflow.module

File

./workflow.module, line 1651

Code

function workflow_create($name) {
  $wid = db_next_id('{workflows}_wid');
  db_query("INSERT INTO {workflows} (wid, name) VALUES (%d, '%s')", $wid, $name);
  workflow_state_save(array(
    'wid' => $wid,
    'state' => t('(creation)'),
    'sysid' => WORKFLOW_CREATION,
    'weight' => WORKFLOW_CREATION_DEFAULT_WEIGHT,
  ));

  // Workflow creation affects tabs (local tasks), so force menu rebuild.
  cache_clear_all('*', 'cache_menu', TRUE);
  menu_rebuild();
  return $wid;
}