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.
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.
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.
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.