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 7 - Develop a workflow event: setup the workflow

Activating the extension:

Now that we have our content class attribute added and have created the workflow event type script. We need to first activate our newly created extension. For this add the following to your site.ini file:

[ExtensionSettings]
ActiveExtensions[]=mytwitter

( more details about activating an extension here: http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Installation/Extensions/Activating-the-extension/ )

 

Declaring our workflow event:

We need to tell eZ that our extension contains a workflow event by creating a workflow.ini.append.php file in the settings folder of our extension:

<?php /*
[EventSettings]
ExtensionDirectories[]=mytwitter
AvailableEventTypes[]=event_twitterstatusupdate
*/ ?>
 

Regenerate the autoload array:

As we have created and used several PHP classes, you will need to regenerate the autoload array, so from command line at the eZ Publish root run:

php bin/php/ezpgenerateautoloads.php

Lets also clear the caches:

php bin/php/ezcache.php --clear-all -s yoursiteaccess
 

Create the main workflow:

Create a new workflow inside the “Standard” workflow group and name it “Twitter Status Update”. Now select and add “Event / Update Twitter Status” event:

Creating the workflow event - eZ Publish

 

Create a post publishing workflow:

Now, following the tutorial at Step 2, create a new workflow and name it “After publishing” workflow and add to it a new “Event / Multiplexer” event and configure it as per Fig. 10:

Configuring the workflow event - eZ Publish

 

You should have “Classes to run workflow” set to “Blog post” (you can add other classes but make sure you’ve added the “twitterstatus” attribute to them) and “Workflow to run” is “Twitter Status Update”.

Assigning the post publishing workflow to a trigger:

Now click on OK and assign the “After publishing” workflow to the “content / publish / after” trigger.

Test:

To test out your new workflow event, edit a blog post, fill in the Twitter Status field and click on submit.

 

Printable

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

Author(s)

Proudly Developed with from