Skip to content

Understanding ECA concepts

ECA (Events - Conditions - Actions) models help you automate business processes in Drupal by responding to events that happen on your site. Think of ECA as a watchful assistant that can detect when something happens, check if certain conditions apply, and then take appropriate actions.

Core components

Events

Events are triggers that start an ECA process. These could be things like:

  • A user logging in
  • Content being created or updated
  • A form being submitted
  • A scheduled time arriving
  • A custom event you define

When an event occurs, ECA checks if any models are listening for that event and runs them if so.

Conditions

Conditions are checks that determine whether actions should run. They act as filters or guards, ensuring actions only happen when appropriate. For example, you might want to:

  • Check if a user has a specific role
  • Verify content has certain field values
  • Ensure a threshold has been met
  • Compare dates or times
  • Combine multiple conditions with AND/OR logic

Actions

Actions are the tasks ECA performs when an event occurs and conditions are met. Actions can:

  • Create or update content
  • Send notifications
  • Modify user accounts
  • Interact with external systems
  • Trigger other events
  • Perform custom operations

How components work together

Let's look at a common example: sending a welcome email to new users in a specific role.

  1. Event: User account is created
  2. Condition: User has the "member" role
  3. Action: Send customized welcome email

ECA processes this flow by:

  1. Detecting the account creation event
  2. Checking the user's roles
  3. Sending the email if the condition is met

Next steps

Learn more about specific concepts:

For practical examples, visit our model library.