Jump to content

Use a workflow on a node: Difference between revisions

From NusaATK
No edit summary
 
No edit summary
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{wde_howto|Advanced|[[Leon de Rijke]] <leon [at] ibuildings.nl>}}
{{howto|Advanced|[[Leon de Rijke]] <leon [at] achievo.org>}}


'''To Do: clean this up and make a real howto of it.'''
'''To Do: clean this up and make a real howto of it.'''
Line 5: Line 5:
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:
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:


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


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.
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.

Latest revision as of 09:52, 11 March 2011

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.