Skip to content

Workflow faq

madmatt edited this page Jun 6, 2013 · 7 revisions

How do I apply a workflow to the whole site? I don't want to apply it to each top level page tree

By default the workflow engine looks up any "Parent" relationship to find inherited workflow definitions. Obviously for top level pages this doesn't go anywhere (as ParentID = 0). However, the workflow engine allows a user to define a workflowParent method in a class, which can be used to look at another object for inheriting from. A typical usecase would be for a Page class to look at a SiteConfig for workflow settings, eg

mysite/_config.php

Object::add_extension('SiteConfig', 'WorkflowApplicable');
Object::add_extension('SiteTree', 'WorkflowApplicable');

mysite/code/Page.php

class Page extends SiteTree {
	// other code

	public function workflowParent() {
		return SiteConfig::current_site_config();
	}

	// other code
}
class Page_Controller extends ContentController {
}

Can I use workflow with files? How do I use the FileWorkflowApplicable extension?

Yes, but only if you're willing to write a bunch of code around how it's applied to files and how a workflow is 'started' for a file. There are plans to integrate this with versioned files in a much better way of doing things, but until then it's best to avoid this extension.

What's the FrontendWorkflow stuff I see referenced everywhere?

It's a workflow driven alternative to the MultiForm module. More details on how to use it will be provided later...

Clone this wiki locally