This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Learn » eZ Publish » Creating a simple custom workflow event

Creating a simple custom workflow event

Thursday 09 December 2010 5:01:18 pm

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Step 2 - Setting up a default workflow for content approval

To get familiar with eZ Publish workflows, let setup the default workflow event “Event/Approve” that to have comments approved (we are here talking about the old “Comment” class not the new eZ Comment system). This, of course, can be applied to other type of content classes.

First, login into the admin interface and from the top menu click on “Setup” (you’ll need enough privileges to reach this area and some administrators might have disable access to this area from a site.ini config file). This should bring you to the Cache management page. From the left menu click on the menu “Workflows”

Setting up an eZ Publish workflow event - step 1


As you can see from the above screenshot (Fig. 1), you are now in a page displaying a list of “Workflow groups”. By default there is only one group named “Standard”. Click on “Standard” to browse its content. As per Fig.2, below, there is no workflow created in the “Standard” workflow group by default.

Lets create a new one, it will execute the workflow event for approving content. By its nature, a content approval needs to occur before publication. So we will call our work flow “Before publishing”. To create a new workflow, click on the button “New workflow” (bottom right). This will bring you to the edit page, see Fig. 3 below. For the name, type in “Before publishing”. Within this page, you are able to assign an event to this workflow by selecting and add it using the drop down menu at the bottom. Lets add it and see why this is not useful for us in this situation, select “Event / Approve” from the drop down menu and then click on “Add event” button. Fig. 4 shows you what you should see.

Setting up an eZ Publish workflow event - step 2

Setting up an eZ Publish workflow event - step 3

Setting up an eZ Publish workflow event - step 4


The field “Description / comments” is optional and is for clarity, you can describe what this event is doing. The “Event / Approve” event comes up with few filters that allow you to define when this trigger should be executed:

  • Affected sections: the event will be executed when an object has been published and is part of a node that belongs to the eZ Publish sections selected
  • Affected languages: same here but applies to object published in a certain language
  • Affected versions: do you want to execute the event for a newly created object, on update to an existing object or in both cases?

The next sections allow you to select users or groups of users allowed to approve pending items and groups of users that do not need to have their content approved.

Adding this event directly to our new workflow does not allow us to apply the content approval event to only Comments, this will be applied to any content being published! To achieve this requirement we will first remove the event we just added, create another workflow and come back to this one and configure a workflow multiplexer.

First, lets delete this event: tick the box next to “1(1) Event / Approve” then click on “Remove selected events” at the bottom. Then click on “OK” at the bottom of the page to save our “Before publishing” workflow.

Back to the workflow list of the “Standard” workflow group, create a new workflow and name it “Content approval”. Add the “Event / Approve” event and configure it for “All sections”, “All languages”, “All versions”. During the development and test we will add our self in the “Users who approve content” list. Alternatively you could also add your group into “Groups who approve content”. Now click on “OK”.

Back to the workflow list of the “Standard” workflow group, you should now see two workflows: “Before publishing” and “Content approval”. The latter is applying content approval process to any content being published. But lets edit “Before publishing”, by either clicking on it and then on “Edit” or by clicking on the pencil icon on the right. In this workflow instead of adding a “Event / Approve” event, lets add “Event / Multiplexer”. The multiplexer event will allow you to run another workflow within our current workflow but with more control option (see Fig. 5).

Setting up an eZ Publish workflow event - step 5


Now you can see a new filter column called “Classes to run workflow”. This will allow us to select “Comment” and run this event only on “Comments” objects being published. The selection “Users without workflow IDs” allows us to select group of users not affected by this multiplexer event. You could unselect everything and configure it in our “Content approval” workflow by adding the groups in the users that don’t need approval selection box.

In the “Workflow to run” drop down box, select our “Content approval” workflow and click on “OK”.



Printer Friendly version of the full article on one page with plain styles


Proudly Developed with from