Workflow event type
Table of contents:
Location
In the kernel, workflow event types are located in kernel/classes/workflowtypes. In extensions, custom workflow events are located in the eventtypes directory.
Extensions
How to add your own workflow event type(s) in an extension?
- workflow settings file path: myextension/settings/workflow.ini.append.php
- setting: [EventSettings] ExtensionDirectories[]= myextension
- setting: [EventSettings] AvailableEventTypes[]=event_ myevent
- design settings path: myextension/settings/design.ini.append.php
- setting: [ExtensionSettings] DesignExtensions[]= myextension
- PHP file path: myextension/eventtypes/event/ myevent/ myeventtype.php
- PHP class name: MyEventType
- template for workflow event edit: design/standard/templates/workflow/eventtype/edit/event_ myevent.tpl
- template for workflow event view: design/standard/templates/workflow/eventtype/view/event_ myevent.tpl
(the bold text represents the variable parts of the names, you should alter them for your extension)
Your event type class
Your own event type class needs to extend eZWorkflowEventType. After your class definition, you also need to register it in the system.
include_once( 'kernel/classes/ezworkflowtype.php' ); class MyEventType extends eZWorkflowEventType { const WORKFLOW_TYPE_STRING = "myevent"; public function __construct() { // Set descriptive name $this->eZWorkflowEventType( MyEventType::WORKFLOW_TYPE_STRING, 'My event' ); } function execute( $process, $event ) { // Do stuff... return eZWorkflowType::STATUS_ACCEPTED; } } eZWorkflowEventType::registerEventType( MyEventType::WORKFLOW_TYPE_STRING, 'MyEventType' );
Troubleshooting
If eZ Publish doesn't seem to want to load your workflow event type, then you might want to check out some useful tips to get it to work at the Troubleshooting extensions page.