Access denied to Form field: set as disabled (eca_form_field_disable)
Problem/Motivation
Executing the action Form field: set as disabled (eca_form_field_disable) results in an Access denied error.
The log message:
Access denied to Form field: set as disabled (eca_form_field_disable) from ECA Test (test) for event Drupal\eca_form\Event\FormBuild:
- event (DTO)
- machine-name (string "eca.form.build")
- entity (Entity node/article//)
- node (Entity node/article//)
- user (Entity user/1/admin)
- form (DTO)
- id (string "node_article_form")
- base-id (string "node_form")
- operation (string "default")
- num-errors (integer "0")
Steps to reproduce
- In a fresh Drupal 9.5 site, install and enable ECA and the ECA Form submodule.
- Create a model that includes the Form field: set as disabled action.
- Test the model by performing an action that triggers the event.
I tested this on a new Drupal install that I set up to learn about the ECA module and haven't been able to get the eca_form_field_disable action to run successfully.
I've tried a few different events (without conditions), like content_entity_prepareform and form_form_after_build, but haven't been able to get 'set as disabled' to execute. I've also tried this with 'Execute models with user' (with uid 1) and with the 'switch user' action.
I've also tried the same events with different actions, for example Form: set method (eca_form_set_method) has run successfully.
Here is my config:
langcode: en
status: true
dependencies:
module:
- eca_form
- eca_user
id: test
modeller: core
label: Test
version: '1'
weight: null
events:
form_form_build:
plugin: 'form:form_build'
label: 'Build form'
configuration:
form_id: node_article_form
entity_type_id: ''
bundle: ''
operation: ''
successors:
-
id: eca_switch_account
condition: null
conditions: { }
gateways: { }
actions:
eca_switch_account:
plugin: eca_switch_account
label: 'User: switch current account'
configuration:
user_id: '1'
successors:
-
id: eca_form_field_disable
condition: null
eca_form_field_disable:
plugin: eca_form_field_disable
label: 'Form field: set as disabled'
configuration:
flag: true
field_name: op
successors: { }