Event Condition Action

ECA, the no-code solution
that empowers you to orchestrate your Drupal sites

DrupalDevDays 2023, Vienna
go.lakedrops.com/eca-ddd2023

Jürgen Haas

20 July 2023

About us

Agenda

  1. Introduction
  2. Objectives
  3. Demo
  4. ECA Architecture
  5. Modeller
  6. Roadmap

go.lakedrops.com/eca-ddd2023

Introduction

For a huge customer project, which eventually started to migrate from Drupal 7 to 9, we faced the problem that the old site heavily used the Rules module - and repeated research convinced us that Rules wasn’t ready for the job.

Neither custom code nor hard-coded business logic was on.

It was time to consider a brand-new approach!

The idea’s history

Action taken

Proposed the solution to the client:

  • Let’s build the processor from scratch
  • Let’s use a standard’s based UI to get all stakeholders involved
  • Let’s publish that as Open-Source module on drupal.org

Reasoning: this will not only solve YOUR problem but also allows other developers and agencies to contribute and maintain the module over time.

The customer agreed and work started in early July 2021.

Objectives

=>

ECA got started to provide a “Rules” equivalent for Drupal 9 and beyond.

While getting close to deliver on that objective, ECA solves additional challenges and helps to trim-down the overhead of each Drupal application.

Reduce the need for custom modules

Far less likely your site needs a custom module for …

  • most of the hooks
  • form altering, validation or submit handlers
  • specific needs for cron or queue tasks
  • sending notifications
  • access control

Reduce number of modules

Make a few helper modules redundant, like e.g. …

Transparency for business owners

Provide a tool where stakeholders who understand their business logic, but not necessarily Drupal details, can participate in building and maintaining the configuration throughout the lifecycle of the Drupal application.

Solid workflow

At the same time, Drupal CMI helps to track all the changes.

Demo

ECA Architecture

  • ECA is a processor - Period!
    No more, no less
  • Event subscribers listen to all Drupal events and trigger the ECA processor
  • ECA executes all available models that contain any of those events
  • ECA models are config entities

Where does the config come from?

ECA doesn’t care!

What components does the processor support?

  • Events: all Drupal events - you can add custom events
  • Conditions: ECA provides a plugin manager
  • Actions: all Drupal actions - you can add custom actions

Gateways, as a kind of extended conditions is also supported, not fully functional yet.

What’s already included in ECA?

  • Processor for ECA config entities with all contained rules
  • Plugin managers for modellers, events and conditions
  • Interfaces and abstract base classes and traits
  • Integration of all actions from Drupal core actions module
  • Support for caching, loops, logging, states, tokens, etc.
  • Prevent recursion
  • TypedData support
  • Tests, tests and tests

Drupal Core (version 9 or later) is the only dependency!!!

16 + 3 Submodules

  • ECA Access
    control entity/field access
  • ECA Base
    context, cron, state, token
  • ECA Cache
    read, write, invalidate
  • ECA Config
    listen, read & write config
  • ECA Content
    entities, fields, token, etc.
  • ECA Endpoint
    define custom routes
  • ECA Form
    build, validate, submit, etc.
  • ECA Language*
    negotiate and switch
  • ECA Log
    create and listen
  • ECA Migrate
    listen to all migrate events
  • ECA Misc
    kernel, Drupal core, routing
  • ECA Queue
    task queue, scheduled tasks
  • ECA Render
    create/alter elements
  • ECA User
    all hooks, switch, roles
  • ECA Views
    query, export, etc.
  • ECA Workflow
    transitions, etc.
  • ECA UI
  • ECA Modeller BPMN
  • ECA Development

*) Coming in ECA v2

3 special submodules

ECA UI provides access to the ECA admin interface and to enabled modellers. Like views/fields/menu/etc, ui components can be turned off. This is useful for production sites where critical configuration may have to be hidden.

ECA Modeller BPMN abstract implementation of all BPMN related pre- and post-processing. Separate modules like BPMN.iO and Camunda utilize this common functionality and only implement the frontend features.

ECA Development comes with a couple of Drush commands and code generators.

Contrib modules supporting ECA

Preparing support for more contrib

Modeller

  • A modeller is the user interface for ECA config entities.
  • It can be integrated as an @EcaModeller plugin, that stores models as config entities. The plugin manager is provided by the ECA module.
  • The UI could be BPMN-based, but not necessarily.
  • Three modellers are already integrated:
    • BPMN.iO
    • Camunda
    • ECA Core Modeller

BPMN.iO

Integrated in Drupal’s admin UI. Everything is provided by BPMN.iO module.

More information

Camunda Desktop Client

Provided by the Camunda module.

Download

ECA Core Modeller

Simple low-level UI to ECA config entities, using Drupal’s form API to build event-driven action chains with optional conditions. Provided by the eca_cm module.

Structure: Modeller

Possible modellers

Roadmap

Code Analysis (v1.0)

ECA

Directories: 111
Files: 358
Lines of Code: 41.889
Comment Lines of Code: 31%
Non-Comment Lines of Code: 69%

224 tests / 3.100 assertions
Coverage: 94% files / 83% lines

BPMN.iO

Directories: 1
Files: 2
Lines of Code: 148
Comment Lines of Code: 28%
Non-Comment Lines of Code: 72%

Code Style: all clean

All components tested on Drupal 9 and 10 with PHP 7.4, 8.1

Team effort: approx. 3.000 hours

Releases

Version Date
First commit
22nd July 2021
1.0.0-RC1 22nd June 2022
1.0.0 22nd July 2022
1.1.0 12th December 2022
1.1.4
14th July 2023
2.0.0 Later this year

Branch 1.2.x contains all new feature and will turn into ECA 2.0:

  • PHP >= 8.1
  • Drupal >= 10

What’s coming in ECA 2.0?

  • Refactoring for PHP 8.1 and Drupal 10
  • ECA Model Inspector
  • Gateway support
  • A11y improvements
    • Drupal form API in modeller’s UIs
    • using auto-complete and other widgets
    • may allow for context sensitivity
  • More plugins and contrib module integrations
  • Optimizations

Any help is highly appreciated

  • Development
    • ECA and plugins
    • Optimization of the integrated BPMN.iO client
    • Tests
    • Integrate your own module(s)
  • Review and feedback
  • Translations
  • Support
    Issue queue and in chats
  • Documentation
    • Sample models
    • Tutorials
    • Best practice
    • and much more
  • Descriptions on the drupal.org project pages
  • Spread the word

Join us in the #ECA channel on Drupal Slack

A word on the ECA Guide

Documentation on ECA and its eco-system

ECA Guide
ECA TV

Thanks - Q&A



Started as a rules engine for Drupal 9 …

… landing in the world of Low code - no code

ECA helps Drupal reaching new territory!