Rules | Modules Unraveled

109 Getting Rules Ported to Drupal 8 with Josef Dabernig, Klaus Purer and Wolfgang Ziegler - Modules Unraveled Podcast

Photo of Josef Dabernig, Klaus Purer and Wolfgang Ziegler

#d8rules - Let's support the Rules module for Drupal 8 logo


  • For those new to Drupal, what is the Rules module?

    • Intro Rules: events, conditions, actions
    • Programming for site builders
    • Giving workflows into the hands of the site builders, workflow building blocks like Lego

    The Rules module allows site administrators to define conditionally executed actions based on occurring events (known as reactive or ECA rules).

Example use cases
Build flexible content publishing workflows changes
Send customized mails to notify your users about important updates
Create custom redirections, system messages, breadcrumbs, ...
Build an e-commerce store using Drupal Commerce
And many more…

Rules has fantastic integration with Drupal Core APIs and all structured data exposed using the Entity and Fields systems, over 350 other contributed modules specifically integrate with the Rules API by to provide their own custom events, conditions, actions or exposing custom data in a reusable way.

Use case: Automating processes
Rules serves the need for automating processes like comment moderation, customizable e-mail notifications or event-based calculations on social platforms. These are built by using generic tools like Flag, Organic groups and message module. More specific solutions like Privatemsg, Feeds, Activity, User point or Voting rules also tightly integrate into the system.

What is the Rules module, explain some use cases & tell us about the rules success story

Drupal 8

  • In the last episode, Crell mentioned that because of the advances in D8, there may not be a need for the Rules module. So, I told him that I would ask you guys for a response to that.
  • What Drupal 8 Stuff are you building upon?

Entity API
Out-of-the-box typed data support for all fields, i.e. including custom content entity types

Typed Data API

The Typed Data API was created to provide developers with a consistent way of interacting with data in different ways. Not only does the API allow you to interact with the actual data, it also provides means of fetching more information, or metadata, about the actual data.
The Typed Data API is a low level, generic and reusable object oriented API. One API that implements it is the Entity API - Drupal’s primary data model.

-> Unification of metadata systems of Drupal 7.

Conditions & Actions

We've got an Actions and Conditions API in core already, so one might think another huge part has been taken care off. Unfortunately, no - those APIs have been created/ported with other use cases in mind, so they do not cater for all the more advanced features Rules users are used to.

While I tried to make sure they fit Rules needs as far as possible when they were introduced/updated, they do not fit our needs yet and it might be impossible to make them fit without breaking those APIs. For Rules 8.x we plan to work on improving those APIs (from contrib) as needed first, so we can ensure they fit Rules' requirements.

Once we are sure everything works out we'll know what we have to adapt and whether improvements can be contributed to core.
Depending on how that works out, we'll see whether we can build up on the core Action and Conditions API or there will be Rules' variants of those APIs (again :(). For more details please see the related issues:

Rules 8.x Architecture
Rules 8.x Roadmap

Motivation behind Rules in Drupal 8


Porting Rules to Drupal 8 will require a major refactoring of the framework. The Rules Core APIs & functionality will evolve and Drupal 8 rewrite opportunities will be taken into account.

Site building based on Drupal 8 core integration wins
Admin UI usability improvements
Simple Views Bulk operations in core

Reusable components
Plug-in based architecture & fully object-oriented code
Rules data selector for tokens, contexts and other use cases
Typed data widgets & formatters
Embeddable Rules UI components to integrate actions & conditions

Evolved developer experience
Unified DX based on Drupal 8 plug-in system
Symfony 2 event system integration
Deployable config via CMI

Funding, milestones, Corporate & crowdfunding - how will that work out?
- sponsorship by company
- crowd funding
- What happens if the funding does not succeed?

How & who
- fago, klausi, dasjo, nico

crowd funding is live now -!!!

Who supports you already?

Why should we help now?

Questions from Twitter