Event Condition Action - Business Process Modeling in Drupal 9+

ECA: Event - Condition - Action

Our new module suite intends to replace the popular 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 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 excerpts about replacing rules UI by BPMN.

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

Tools

Comments

John (not verified)

Sat, 09/18/2021 - 14:49

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.

holybiber (not verified)

Thu, 09/23/2021 - 13:50

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!

radzi (not verified)

Mon, 09/27/2021 - 20:43

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

Ed Swiderski (not verified)

Fri, 10/01/2021 - 22:24

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

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.