Event Condition Action

ECA - New rules engine for Drupal 9+

Jürgen Haas

13 January 2022

About us

Agenda

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

Introduction

The Rules module for Drupal 8 is still in its alpha release stage … still needs significant work. (Excerpt description tr_rulez)

Rules D8+

Previously

Demo

ECA Architecture

  • ECA is a processor - Period. No more, no less
  • An event subscriber listens to all Drupal events and triggers the processor
  • This processes all available ECA models - all models for the current event
  • The 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
  • Extensive context stack support (dependency)
  • Support for caching, loops, logging, states, tokens, etc.
  • Prevent recursion
  • TypedData support
  • Tagging for event characterization
  • Tests

10 Submodules

  • ECA Base: context, cron, custom, state, token, etc.
  • ECA Config
  • ECA Content: entities, fields, token, etc.
  • ECA Form: build, validate, submit, etc.
  • ECA Migrate
  • ECA Misc: kernel, Drupal core, routing, etc.
  • ECA Queue: task queue, scheduled tasks, etc.
  • ECA User: login, logout, cancel, switch, roles, etc.
  • ECA Views: query, export, etc.
  • ECA Workflow: transitions, etc.

Preparing support for contrib

Chainable Actions

Imagine, multiple fields of an entity get changed by an ECA process. By default, Drupal core actions would save this entity every single time, which would not only waste lots of ressources, it would trigger additional events every single time.

ECA prevents this by aliasing the responsible core class:

class_alias('Drupal\eca_content\Plugin\Action\FieldUpdateActionBase', 'Drupal\Core\Field\FieldUpdateActionBase');

Structure: Events

Structure: Conditions

Structure: Actions

Modeller

  • A modeller is the user interface for ECA config entities.
  • It can be integrated as a @EcaModeller plugin, that stores models as config entities. The plugin manager is provided by the ECA module.
  • May be BPMN but not necessarily. Only the structure Event - Condition - Action matters.
  • Two modellers are already integrated:

Camunda Desktop Client

Download

Integrated by Camunda BPMN module.

BPMN.iO

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

More information

Structure: Modeller

Possible modellers

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

Reduce number of 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

Reduce number of modules

Transparency for business owners

Provide a tool where people understanding their business logic, but not necessarily Drupal details, can participate in building and maintaining the configuration throughout the lifecycle of the Drupal site.

Solid workflow

At the same time, Drupal CMI helps to track all the changes. In the future, we may even be able to support revisions and moderation, so that rock-solid workflows can be applied when needed.

Roadmap

Beta-1 on 3rd November 2021

Beta-2 on 12th January 2022

Stable Release 1.0.0 in early 2022

Any help is highly appreciated

  • Development
    • ECA and plugins
    • Optimization of the integrated BPMN.iO clients
  • Tests
  • Review and feedback
  • Support (Issue queue and in chats)
  • Documentation
  • Translations
  • Descriptions on the drupal.org project pages
  • Spread the word

Discussion