Would be very handy for a module to be able to provide a workflow states, just like actions can.

This way a module can be installed that creates it's own workflow path and states, very handy

Comments

moshe weitzman’s picture

YES. This should work just like Views module, where export/import is offerred.

merlinofchaos’s picture

For this to really be effective, workflow states would need to be named, much like views and actions are named, because IDs are horrible for programmatic use.

Also, it's a little difficult to associate workflow with a node if the workflow table is partially in code and partially in the db, so I'd think that a module would need to write its default workflow into the database upon install. And if that's the requirement, all that's really necessary is named states.

dado’s picture

+1 for a workflow API

jvandyk’s picture

Currently the way to do this is to populate the workflow tables during your module's install.

fago’s picture

It would be useful to have a field, that declares a workflow to be created automatically, so that the user can't delete it, such as its already the case for the creation state. Further the workflow creation function workflow_create($name) should return the wid of the new workflow...

neclimdul’s picture

This is something of interest to me. My worry would be that after a module creates its workflow, it seems far too easy for a admin to delete it. If that workflow is vital to the functionality of the module that could be exceedingly bad. Would a system flag or something similar be something considered for addition to the workflow module or should modules doing this plan on doing fapi hacks to warn/stop users for breaking important workflows?

moshe weitzman’s picture

admins can do all sorts of bad stuff. they can delete users, delete cck types, turn site to maintainence mode, etc. there are no safeties ... yes, use fapi validator if you wan to stop this.

mfredrickson’s picture

Status: Active » Postponed

workflow_create returns the wid of the workflow.

Programmatic creation is important, but I'm going to postpone to 5+

dgtlmoon’s picture

Sounds fine to me, I've been writing some code for a game engine that uses state-engine charts in XMI XML files generated with ArgoUML that seems to work good for following the states/transitions/guards, i'll post some code when it's tidy

moshe weitzman’s picture

Status: Postponed » Active
sirkitree’s picture

Status: Active » Closed (duplicate)

Since this is being worked on here #558378: Make workflows exportable with Features (D6) and here #867186: [EXPORTING] Add machine names to workflows and workflow states I'm going to mark this one as a duplicate.