Skip to main content
Main Image
Bild
ECA Logo
September 17, 2021

Event Condition Action - Business Process Modeling in Drupal 9+

by Richard Papp

Our new module suite intends to replace the popular Drupal 7 Rules module for Drupal 8+. But not only Rules. Actually, it also provides features from other modules (e.g. Automatic Entity Label) and for form validation.

Rules allows site administrators to define conditionally executed actions based on occurring events (known as reactive or ECA rules). You can e.g. display a message to the user or send an email when updating content.

But the Drupal 8+ version is still in alpha release stage and needs significant work. There is a module tr_rulez to fill the gaps, but it is only available as a development version. Business rules is only minimally maintained and not stable, either. So if you wanted to do something similar in Drupal 8+, you would have been left out in the cold, so far.

ECA

In order to upgrade Drupal 7 applications that heavily use rules we looked for an alternative solution for Drupal 9+. Based on earlier discussions on Twitter we came up with an idea for an Event – Condition – Action processor that can handle business process models stored as Drupal config entities.

Twitter - Replace Rules

The models should be created with modellers integrated by plugins either as stand-alone applications or as part of the Drupal user interface. Hence anyone could easily add its own modeller if desired.

Our aim was to reuse existing Drupal core components as far as possible and to rely on Drupal API for new components. Out-of-the-box Drupal provides events, event subscribers and actions. There is also a plugin API that allows to add more components. This way components can be reused anywhere in Drupal, not only in the context of our module.

The only thing we had to add to the processor was a plugin manager for conditions and apply a small trick to chain entity related actions together.

Modeller

Think of a modeller as the user interface for ECA config entities. It can be integrated as a @EcaModeler plugin, that stores models as config entities. The plugin manager is provided by the ECA module.

2 modelers are already integrated. We relied on BPMN modellers so far because non technical users might be accustomed to flowcharts. Similar to Behat, BPMN modellers allow to define and to document business processes in a business-readable language, at once. No need to write extra documentation and a diagram is sometimes worth a thousand words.

Documentation

Tags

Tools

Comments

John (not verified)

We have a few D7 sites that can't be migrated to D8/9 due to heavy usage of Rules and Rules Links modules. So I am hopeful for this solution.

Sat, 18.09.2021 - 14:49 Permalink
holybiber (not verified)

That sounds great! I have a new D9 website, found out that rules doesn't work, tr_rulez is also not really ready and business_rules looks good and I can configure stuff, but most of it is just not working. So I'll look into this and am interested on how this is going on!

Thu, 23.09.2021 - 13:50 Permalink
radzi (not verified)

we use rules scheduler for many things in drupal 7. hopefully ECA will have the same feature

Mon, 27.09.2021 - 20:43 Permalink
Ed Swiderski (not verified)

Set up this week...game changer! Thank you!!!

Fri, 01.10.2021 - 22:24 Permalink

Add new comment

Klartext

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA