Thursday 09 December 2010 5:01:18 pm
This tutorial will guide you through the development of a simple eZ Publish workflow event. At the end of the tutorial, you should be able to create your own workflow event, configure a workflow that would execute the event and configure workflow triggers in the admin interface.
Note : the PDF version of this tutorial, as well as the downloadable extension are here.
eZ Publish comes with several default workflow event: approval, payment gateway etc… In some occasions you will probably need to create your own one. Workflow events are very useful in the case where you need some actions to be done on a published object either before the actual publication occurs (maybe a kind of auto-validation of some content…) or after (generation of a JPEG image from a text field, post publishing notification system…).
In this tutorial we will see how to create a simple workflow event that sends a post to Twitter with a shorten URL (TinyURL) of the node being published.
eZ Publish templating language is quite powerful and for a lot of work it’s all you need. But for this type of development a knowledge of object oriented PHP is required.
Along with how to develop your own workflow event, this tutorial will also explain how to setup workflows and triggers so no previous knowledge is required.
Also require is an understanding of eZ Publish’s structure, of the use of INI files and of the creation/editing of content classes.
As an example application for this tutorial we will be using a quite trendy subject: Twitter. So you will need a test Twitter account and obviously a working test eZ Publish installation from version 4.0+ (it should be working for previous versions, not tested though).
Initially this tutorial was supposed to target intermediate eZ Publish developers, the fact that Twitter has changed their authentication system has made it a bit more complexe. So as a bonus this tutorial will also briefly cover the use of a CLI script using the eZScript class. This will require you to have a good knowledge of command line scripts and a terminal access (ssh) to your server as the Twitter authentication will be done through it.