Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

The eZWorkflowType API

The methods of a workflow event type - execute() and its status constants, allowed triggers, the settings form, cleanup - and its registration, with signatures and a tested example.

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/help/extension-development/part-8-reference/ezworkflowtype-api.md

On this page

The eZWorkflowType API

Part 8, reference 17. A workflow event type is a step administrators can put into a workflow, which a trigger runs before or after an operation (publishing, adding to the basket, signing in). It is a class that extends eZWorkflowEventType (kernel/classes/ezworkfloweventtype.php, itself based on eZWorkflowType in kernel/classes/ezworkflowtype.php). The how-to is Workflow event types and the tutorials A workflow event, by hand and With RAD: a workflow event.

Registration

CallNotes
public function __construct( $typeString = '', $name = '' )call from your constructor: parent::__construct( 'myevent', ezpI18n::tr( 'extension/myext', 'My event' ) );
eZWorkflowEventType::registerEventType( $typeString, $class_name ) (static)once, at the end of the file
setTriggerTypes( $allowedTypes )which operations it may run in, e.g. array( 'content' => array( 'publish' => array( 'before', 'after' ) ) )

Plus workflow.ini [EventSettings] ExtensionDirectories[] and AvailableEventTypes[]=event_<typestring>.

Running: execute()

function execute( $process, $event )

It returns one of the status constants of eZWorkflowType:

ConstantMeaning
STATUS_ACCEPTEDdone; the workflow goes on
STATUS_REJECTEDstop; the operation does not happen
STATUS_DEFERRED_TO_CRON, STATUS_DEFERRED_TO_CRON_REPEATrun later in the workflow cronjob, once or until accepted
STATUS_FETCH_TEMPLATE, STATUS_FETCH_TEMPLATE_REPEATshow a template to the user (a form), and run again after it is posted
STATUS_REDIRECT, STATUS_REDIRECT_REPEATredirect the user
STATUS_WORKFLOW_CANCELLED, STATUS_WORKFLOW_DONE, STATUS_WORKFLOW_RESET, STATUS_RUN_SUB_EVENT, STATUS_NONEspecial cases

$process->attribute( 'parameter_list' ) holds the operation's parameters (for publishing: object_id and version).

<?php
class myExtLogPublishType extends eZWorkflowEventType
{
    const WORKFLOW_TYPE_STRING = 'myextlogpublish';

    public function __construct()
    {
        parent::__construct( self::WORKFLOW_TYPE_STRING, ezpI18n::tr( 'extension/myext', 'Log publishing' ) );
        $this->setTriggerTypes( array( 'content' => array( 'publish' => array( 'after' ) ) ) );
    }

    function execute( $process, $event )
    {
        $parameters = $process->attribute( 'parameter_list' );
        eZLog::write( 'Published object ' . (int)$parameters['object_id'], 'myext.log' );
        return eZWorkflowType::STATUS_ACCEPTED;
    }
}

eZWorkflowEventType::registerEventType( myExtLogPublishType::WORKFLOW_TYPE_STRING, 'myExtLogPublishType' );

The event's settings form

When the administrator adds the event to a workflow, it can have settings of its own:

MethodUse
initializeEvent( $event )defaults for a new event
validateHTTPInput( $http, $base, $event, &$validation )check the posted settings
fetchHTTPInput( $http, $base, $event )store them into the event (its data_int1, data_text1 ... fields)
attributeDecoder( $event, $attr )computed attributes of the event for templates
typeFunctionalAttributes()the names of those attributes
customWorkflowEventHTTPAction( $http, $action, $workflowEvent )custom buttons in the form
storeEventData( $event, $version ), workflowEventContent( $event )events with data in tables of their own

Templates: workflow/eventtype/edit/event_<typestring>.tpl and workflow/eventtype/view/event_<typestring>.tpl, found through the design chain.

Cleanup

MethodUse
needCleanup()return true if cleanup() must run
cleanup( $process, $event )when the process ends
cleanupAfterRemoving( $attr = array() )when the event is removed from a workflow

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x