Unify ActionInterface/ActionBase for extended usage

Created on 25 April 2025, 3 months ago

Problem/Motivation

Currently actions are used for triggering tasks in Drupal and are used in core by bulk view operations(content, users, etc) and extensively in contrib(ECA, AI Agents, etc). They were also previously used by the Rules module, which since moved to their own implementation as core was missing some necessary requirements. Some of these requirements have been attempted to be fixed previously Use Context system for actions Needs work , however lost traction for one reason or another.

Having talked to @jurgenhaas( ECA ), @fago( Rules ) and @yautja_cetanu @marcus_johansson (AI/AI Agents), there is definitely agreement that improving Actions and unifying their usage would be mutually beneficial across these modules. We should also make sure these improvements give credit to those who worked on this previously and in the Rules module.

Current problems include:

  • No additional parameters can be passed to actions, and loosely allow entity parameter
  • Can't currently describe required/optional/constraints/etc for parameters necessary for execution
  • They do not return or describe success/failure
  • Actions that create new values do not describe or return said data
  • Some actions only queue themselves up for said behavior instead of doing the desired behavior(i.e. riskier operations like 'delete'). This is not flexible to alternative flows that may not want to enforce a confirmation form.

Proposed resolution

Update action subsystem to support the below requirements.

Requirements:

  • Inputs should be described using Context API
  • Outputs should be described using Context API, when applicable(i.e. new entity created)
  • Actions should do the expected action on execute and not require queues/confirmation forms(though we still need to support this use case)
  • Actions should be executable just-in-time with only provided contexts
  • (Confirm?) Actions should be executable with only configuration(no additional provided contexts)
  • Actions should return a status message on execute (e.x "Node 'My new node' created successfully")
  • execute() should use contexts, and not expect arguments
  • access() should use contexts and not expect additional arguments
  • Remove 'type' property from attribute
  • (Confirm?) Separate access control for ui configuration

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.1 🔥

Component

base system

Created by

🇺🇸United States michaellander

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024