Drupal

Drupal module to watch: ECA (Event-Condition-Action), the successor to the Rules module!

Published on 02 November 2022
Presentation of the Drupal ECA module - bluedrop.fr
Module presented and discussed at a Drupal France community meetup, ECA seems very ambitious to us. It also appears to be the most credible successor to the famous Rules module, which has had its day!

ECA Module

Event condition action (ECA) is shorthand for referring to the structure of active rules in event-driven architecture and active database systems.

Such a rule traditionally consists of three parts:

  • The event part, which specifies the signal that triggers the invocation of the rule.
  • The condition part, made up of a logical test that, if satisfied or evaluated as true, leads to the execution of the action.
  • The action part, materialized by updates or invocations on local data.

Inspired by BPMN (2) during a project to upgrade a Drupal 7 site to 9 with intensive use of rules, the Drupal developers’ team (3) studied possible approaches and built an experimental module to handle events based on BPMN models.

ECA as a Successor to the Rules Module

The Drupal Rules module no longer meets current requirements. Still in alpha, it awaits significant further investment. The ECA module was built to provide an equivalent to the Rules module for Drupal 9 and beyond. While getting closer to that goal, ECA solves other issues:

  • It allows you to reduce the number of custom modules. ECA lets you replace hooks, form alters, CRON-related tasks, validation or submission handlers, and more.
  • It allows you to reduce the number of contributed modules. For example, it's easy to configure a post-login redirect with ECA, making the “Redirect after login” module unnecessary. Fewer modules mean less maintenance! To name a few modules that can be eliminated: Redirect 403 To User Login, Login And Logout Redirect Per Role, Maxlength, Field validation, Computed Field, or Automatic entity label.
  • It provides a tool enabling project teams who understand their business logic, but not necessarily the details of Drupal, to participate in developing and maintaining configuration throughout the lifecycle of the Drupal application. Truth be told, on this point there’s still a long way to go since the interface is still complex to manage.
  • It enables exporting models in XML to reuse rules and schemas on other sites (the models remain configuration entities in Drupal as well).

A proposal has been made to further extend the module to cover content revisions and moderation, making it possible to apply robust workflows when needed.

User Interface

While the interface might seem daunting for those new to flow analysis, it becomes very effective once the principles are mastered. It lets you visualize information flows, the rules that need to be triggered as actions occur on the site, and the associated permissions.

The module is still young, with at least 200 sites having installed it. However, there is a Slack channel where you can keep track of the module’s developments: https://drupal.slack.com/archives/C0287U62CSG

In our team’s opinion, shared by participants at today’s Drupal France meetup, this module seems to have a real future. It should be watched closely and tested as soon as it fits your project’s scope.

The module: https://www.drupal.org/project/eca
Documentation: https://ecaguide.org/
Video Tutorials: https://ecaguide.org/resources/tutorials/
BPMN: www.bpmn.org
Thank you Elie!

Notes:

(1) An active database is an automated interface that executes certain functions depending on specific information inputs.

(2) It’s a visual modeling language for business analysis applications and the specification of business process flows. It is an open standard notation for graphical flowcharts used to define business process flows. It’s a popular, intuitive graphical language easily understood by all business stakeholders, including users, analysts, software developers, and data architects (translated from https://www.visual-paradigm.com/guide/bpmn/what-is-bpmn/).

(3) Jurgen Haas (@jurgenhaas), Richard Papp (@boromino), Max Haupt (@mxh), Daniel Speicher (@danielspeicher) and Ralf Koller (@rkoller).

Read more articles on Drupal