Jump to content

Use a workflow on a node

From NusaATK

ATK Howto: Use a workflow on a node

Complexity: Advanced
Author: Leon de Rijke <leon [at] achievo.org>

List of other Howto's

To Do: clean this up and make a real howto of it.

To use the workflow module on a node you have to add a configuration file named <module>.workflow.inc.php (with <module> being the module you are working on). In this configuration file you need to enter the following settings:

$options = array();

// actions that are used by your node. The ones listed are common, but if you use any custom actions add them here
$options["actions"]                = array("edit", "delete", "view", "copy"); 

// actions that should not have any workflow and should be ignored
$options["ignore"]                 = array(); 

// fields that can be altered by the workflow module using actions.
$options["fields"]                 = array("title", "location", "code", "hide", "accessible"); 

// fields that group different versions (only used when using multi-workflow)
$options["multi-version"]          = array("location", "code");

// fields that should be displayed in addition to the multi-version fields.
$options["version-display-fields"] = array("title", "hide"); 

// fields that can be used in e-mails that are send by the workflow module.
$options["mail-fields"]            = array("id", "location", "code", "title"); 

// workflow node template (you should not need to change this, only when building rare and custom flows.)
$options["template"]               = "modules/workflow/framework/templates/node.tpl"; 
  
// register the node to the workflow module using the options stated above
wf_registerNode("mymodule.mynode", $options);

After doing this you will see a new node available in the backend administration of the workflow module. When you select the node you can start adding the states and transitions you need for the workflow.