ECA Field WidgetΒΆ
Plugin ID: eca_field_widget_actions:eca_field_widget
Available since: 2.1.11
Provided tokens
| Token | Description |
|---|---|
[user] |
The current user. Alias: current_user |
[htmx] |
Information about the current HTMX request. |
[htmx:is_request] |
Whether the current request was sent by HTMX ("1" or "0"). |
[htmx:boosted] |
Whether the current request was boosted by HTMX ("1" or "0"). |
[htmx:history_restore] |
Whether the current request is for HTMX history restoration ("1" or "0"). |
[htmx:target] |
The value of the HX-Target request header. |
[htmx:trigger] |
The value of the HX-Trigger request header. |
[htmx:trigger_name] |
The value of the HX-Trigger-Name request header. |
[htmx:current_url] |
The value of the HX-Current-URL request header. |
[entity] |
The entity being edited. |
[field_name] |
The name of the entity field for which the field widget is used. |
[field_key] |
The index of the field starting with zero and going up if it is a multi-value field. |
[event] |
The event. |
[event:machine_name] |
The machine name of the ECA event. |
[session_user] |
The user account that dispatched the event, regardless if ECA is processing models under a different account. This is only available if ECA is configured to always run under a specific account. |
This event has currently no configuration options. However, you may want to at least give it a label because that's how it will be displayed in the form display configuration.
To get a field widget action from ECA work with form fields, you start with this event and the subsequent actions and conditions receive the above tokens with which you can build your process.
The
Set field widget value
action is the only way to return a value to the field widget. The [entity]
token holds an entity built from the current form state for reading only. That
entity is never saved, and it is never read again after the event, so setting a
field value on it has no effect on the form.
One button fills one field
A field widget action can only ever fill the single field its button belongs to. The response addresses one selector, resolved from the position of the clicked button in the form, and a model has no way to address another field. To populate several fields from one interaction, use a Build form event with the Form field: set value action, or compute the values when the entity is saved.