Jump to content

Use a workflow on a node

From NusaATK
Revision as of 14:49, 1 May 2007 by Leon (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Wde howto

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();
$options["actions"]                = array("edit", "delete", "view", "copy"); // actions that are used by your node. The ones listed are common, but if you use any custom actions add them here
$options["ignore"]                 = array(); // actions that should not have any workflow and should be ignored
$options["fields"]                 = array("title", "location", "code", "hide", "accessible"); // fields that can be altered by the workflow module using actions.
$options["multi-version"]          = array("location", "code"); // fields that group different versions (only used when using multi-workflow)
$options["version-display-fields"] = array("title", "hide"); // fields that should be displayed in addition to the multi-version fields.
$options["mail-fields"]            = array("id", "location", "code", "title");  // fields that can be used in e-mails that are send by the workflow module.
$options["template"]               = "modules/workflow/framework/templates/node.tpl"; // workflow node template (you should not need to change this, only when building rare and custom.)
  
wf_registerNode("mymodule.mynode", $options); // register the node to the workflow module using the options stated above

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.