Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

ECA Field Widget Actions

Security covered Under active development 15 sites

Part of the ECA ecosystem · 51 projects

This module allows you to use ECA models to power custom action buttons displayed next to form fields, enabling you to define complex logic for those buttons without custom code. It's useful for features like content suggestions, AI-powered field filling, and on-demand data lookups.

Integrates ECA with the Field Widget Actions module, allowing you to build custom field widget action buttons powered by ECA models.

How it works

The Field Widget Actions module attaches action buttons to form fields -- for example a "Suggest" button next to a text field. This module bridges those buttons to ECA so you can define what happens when a button is clicked using an ECA model instead of custom code.

  1. Create an ECA model with the ECA Field Widget event.
  2. The module automatically registers a Field Widget Action plugin for that model. It appears in the list of available actions for any field widget.
  3. When a user clicks the action button on a form, the ECA event fires with the current entity, field name, and field index as context.
  4. Your ECA model evaluates conditions and executes actions -- for example calling an external API or processing the entity's existing field values.
  5. Use the Set field widget value action to return a list of suggestions to the field widget.

This is useful for content suggestions, AI-powered field filling, data lookups, or any scenario where a field value should be computed on demand.

Compound fields

A compound field -- Address, Link, Smart Date, Date range, Custom Field -- stores several properties per item, so a single string cannot fill it. Return a mapping of the field's property names instead:

  1. Enable Fill the field directly on the action button in Manage form display.
  2. In the Set field widget value action, enable Interpret above value as YAML format and write one line per property.

For a link field:

uri: "https://example.com"
title: "Example"

For an address field:

country_code: "US"
address_line1: "1600 Pennsylvania Avenue"
locality: "Washington"
administrative_area: "DC"
postal_code: "20500"

A list of such mappings fills a multi-value field:

- uri: "https://example.com"
  title: "Example"
- uri: "https://example.org"
  title: "Another example"

The value is written onto the entity and the widget is then rebuilt from it, exactly as when an already saved entity is opened for editing. Any widget that can display a saved value therefore works, without this module knowing anything about the field type.

To find out which property names a field has, look at the field type's item class -- LinkItem::propertyDefinitions() declares uri, title and options -- or open ECA's token browser, where a saved value is offered as [entity:field_address:0:locality] and the last segment is the property name.

Wrap tokens in quotes so the YAML stays valid, for example title: "[node:title]".

Drupal 11 · not 10 PHP >=8.1

Ask your assistant about ECA Field Widget Actions

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Mar 2026
Latest release
1 month ago
Releases (12 mo)
4 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.0.0 Stable 11 PHP >=8.1 Sep 18, 2026
1.0.0-beta2 Pre-release 11 Aug 27, 2026
1.0.0-beta1 Pre-release 11 Apr 10, 2026
1.0.x-dev Dev 11 Mar 7, 2026