You are here

function workflow_create in Workflow 6.2

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_create()
  2. 5 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_admin_ui_add_form_submit in workflow_admin_ui/workflow_admin_ui.module
Submit handler for the workflow add form.

File

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

Code

function workflow_create($name) {
  $workflow = array(
    'name' => $name,
    'options' => serialize(array(
      'comment_log_node' => 1,
      'comment_log_tab' => 1,
    )),
  );
  drupal_write_record('workflows', $workflow);
  workflow_state_save(array(
    'wid' => $workflow['wid'],
    'state' => t('(creation)'),
    'sysid' => WORKFLOW_CREATION,
    'weight' => WORKFLOW_CREATION_DEFAULT_WEIGHT,
  ));

  // Workflow creation affects tabs (local tasks), so force menu rebuild.
  menu_rebuild();
  return $workflow['wid'];
}