17 years in Drupal, 25 in web

 

Portland, OR

 

ICF.com

 

Faves: Theatre, Pottery, Photography, Podcasts, Beer, Coworking, Mentoring, and Open Source

DrupalEasy
Podcast

DrupalEasy.com/podcast

@DrupalEasy

 

Recent Episode:
Backend API Integration /

Case Study

 

Find us in your favorite podcast app.

BATTideas.com

art & technology

 

 

 

OurYellowHouse.com

community & work

Lashing

Lashing

[lash-ing] verb

1. to secure items together in a somewhat rigid manner

Lashing

  • non-permanent
  • utilitarian
  • improvised
  • re-usable materials
  • methodical

Lashing vs. Duct Tape

Duct Tape

  • non-permanent
  • utilitarian
  • improvised
  • re-usable materials
  • methodical

Duct Tape!

ECA

Custom Code

ECA

Declarative over Imperative

Describe the functionality you want instead of hard coding it.

Would you rather order a sandwich or have to write a step by step tutorial for how to make a sandwich before you can order it?

Maintainability

Fewer moving parts, fewer security patches. Fewer things become obsolete when Drupal gets a major version.

The Phone Loophole

I could walk you through changing things over the phone.

Change Business Logic without a

deploy

Promotions, deal of the day, move at the speed of thought.

 

If you have true CI/CD this is less of an issue.

Drupal is not about writing code

Drupal is all about functionality

"using the internet to eliminate middlemen"

Dries Buytaert

the programmer is a middleman between your data and your business

not knowing how to code can be as bad as having as having a middle man

How to: ECA

1. Deconstruct
2. Modify
3. Construct
4. Compose
5. Trigger

Deconstruct

Deconstruct?

Deconstruct!

Deconstruct!

Deconstruct!

1. when this Event happens

2. if this
Condition is met

3a. do this Action

3b. or do this
Action

Event:

Condition:

Action:

before I leave for work

if there are dark clouds in the sky

bring the umbrella from the hall

Event:


Condition:
 


Action:

after I leave for work

if the day is not Friday

get credit card from wallet

purchase coffee with credit card

if the time is before 8:45am

"After 20 minutes of Inactivity,

Remind User of Empty Shopping Cart"

Modify

(demo)

"Woah, not sure what this model does..."

"I can edit this message though."

Construct

(demo)

If I unpublish a node,
notify all the commenters

What Event?

Saving a node

What Condition?

If it's unpublished

What Action?

Send a message to each commenter

  • Load a list of all comments
  • Get one item from the list
  • Email the Author
  • Load Next Item? (later)

/admin/config/workflow/eca/add

1. Name your Model

 

 

 

 

2. Add a description

/admin/config/workflow/eca/add

3. Circle = Event

 

"When this happens..."

4. I have an event,

give it a Name

 

 

5. Choose a Template

6. Update content entity

 

"When *this* happens..."

7. Entity Type = Content

 

Bundle = Article

Our first

"Action"

Always Start with
Documentation

Templates Once You Sketch Things Out

Keep Sketching

Keep Documenting

Keep Templating

(if you want)

What about unpublished?

This is the "Condition"

from Event-Condition-Action

Event, Condition and Action

...but only emails the first commenter?

I've Pressed Them All

Except One...

Gateway is where

a branch or a loop

starts

 

Adding the Gateway is the

final form for our Model

to loop over all the comments on a node

"Load Comment" action can only grab one comment at a time, it has no idea how many items are in the list, or what's left

Don't Forget to Save!

In a Perfect World™

We make sure this Node was published and is being unpublished...

Compose

(chains / triggers)

1

2

3

4

5

Loop

Send email to these users

Loop

Trigger another Event on these Comments

ECA Model Inception

Compose
(demo)

"Work Slips"

Custom View

"Maths"

Views

Arguments

Load Stuff

Do Stuff

Mike Anello - DrupalEasy

New Content

If "ABC" changes

If "DEF" changes

...etc.

Custom Event

Event Triggers

Views Bulk Operations

Event Triggers

Views Bulk Operations

 

 







Access check can be harder

to set up than the Action

Event Triggers

Drupal Commerce

 

Have your store, cart, orders, SKUs react to custom Events

Event Triggers

Webform

 

What about a contest?

 

Don't allow a judge to edit a submission, but allow them to add notes?

Drupal Remote Dashboard

Event Triggers
(demo)

Recipes

(Starshot / Drupal CMS)

Integrations

(AI / APIs)

Thought Experiment

 

A Game Engine

Unity & Unreal Game Engine

Useful ECA Resources

ECA Guide

 

Config Ignore

drupal.org/project/config_ignore

drupal.org/project/config_readonly

If you want to edit ECA in Production

Run ECA on Cron

e.g. Scheduled Publish

ecaguide.org/library/simple/scheduled_publishing

The "Event" is Cron

e.g. Reminder: You haven't edited your profile in a year

Views Bulk Operations

https://www.drupal.org/project/eca_vbo

Create Custom Display

Does not play nice with regular VBO

Access Check

Must enable each new Event in View Config

Maillog

drupal.org/project/maillog

Show me the emails

Log all messages

Reroute instead of sending

Commerce

drupal.org/project/eca_commerce

Enabling Payment Types

Adding Taxes

Price Adjustments

ECA Forms Support

ECA Forms
drupal.org/project/eca_webform

Event: When a form is being validated

Invalidate a form before it gets saved

Validate fields, display custom messages

Don't need to use Form API

Used by Resource Conflict

Resource Conflicts

https://events.drupal.org/portland2024/session/unleashing-power-eca-no-code-coding-ambitious-site-builders

Check if an event is in the same room at the same time

Use Taxonomy Terms for "rooms"

Can invalidate the form, so it won't be saved if a conflict exists

Workflow

ECA Workflow

React to changes in Workflow State

e.g. Draft, In Progress, Needs Review, etc.

Cache Events

ECA Cache

    Clear Drupal cache bins
    Clear CSS/JS cache
    Clear the cache of specific views
    Clear the cache of specific pages
    Clear the cache of specific menus

 

 

Login Flow

ECA User

Event when the user account is validated.

Organic Groups

drupal.org/project/group_action

Events when a user is added to a group,

Joins/Leaves a group

When group content is added

Context Models

Show Blocks, Menu Items, Taxonomy Terms, etc.

Lash together your Drupal site!

Automate the
Little Things:

ECA

Ryan Price
ICF
@liberatr

slides.com/ryanprice

Made with Slides.com