Skip to content

Sites ECA

Sites ECA lets ECA models react when content joins or leaves a site or gets another origin site, test sites and site roles, and run actions as another site. The Sites tools run as actions through ECA Tool.

Install

A project of its own, drupal.org/project/sites_eca:

composer require drupal/sites_eca-sites_eca
drush en sites_eca

The Composer name carries the project name twice: drupal/sites_eca is still held by the metapackage of the former Sites submodule, a package without code. Requiring that one installs nothing.

Requires Sites, eca (eca).

Configure

A model sets up the plugins in an ECA modeller.

Plugin Kind Does
Sites: content added to a site Event Content now belongs to a site: created on it, added, or moved there as its origin.
Sites: content removed from a site Event Content left a site.
Sites: origin site changed Event Content got another origin site.
Sites: current site is Condition The current site is the chosen one, the hub included.
Sites: content belongs to site Condition The entity belongs to the site, or with Origin site only, has it as origin.
Sites: user has site role Condition The user has the role on the site, inherited roles included; any role when none is chosen.
Sites: switch current site Action The actions after it run on the chosen site.

The events provide [entity], [content_site] (id, label, url, settings, sensitive ones (redacted)) and, for a new origin, [previous_site]. A site can also be Defined by token, a token named after the plugin like sites_switch_site_site_id.

  • An entity form writes the chosen sites after Insert content entity: react on Sites: content added to a site instead.
  • Adding content to a site fires that event again: filter it on a site.
  • Path aliases fire no events.
  • Actions check the access of the user the model runs as (User: switch current account).

Example

Share Hydrion UK's articles with Hydrion:

  1. Event Sites: content added to a site, type Article, site Hydrion UK.
  2. Action Tool: Assign content to a site, Entity entity, Site ID hydrion.

Mara's articles on Hydrion UK then show on Hydrion too. Priya edits Hydrion UK only, so for her the tool refuses: [tool_result:message] says why.

Last updated 2026-10-16

Used in