eca_form: Ajax handler does not work for checkboxes in content entity forms

Issue information

From user: mxh

Related to !302 (merged) !301 (merged)

Contribution record

Fork management

Problem/Motivation

The action "Form: add Ajax handler" does not work when being added to a checkbox field within a content entity form.
It's likely that the handler does not work for other field widgets too.

Steps to reproduce

  • Create Drupal standard installation profile
  • Install ECA with eca_form, eca_content, token and bpmn_io
  • Create a boolean checkbox field for the article content type
  • Add new ECA model that reacts upon "Process form" event, restrict for node as entity type, and article as bundle.
  • As successor, add action "Form: add Ajax handler" and specify the added checkbox field.

Expectation: The form has an Ajax handler on the checkbox field.
Current behavior: No Ajax handler was added.

It looks like that Drupal\eca\Plugin\FormFieldPluginTrait::getTargetElement does not detect the target element, because no "#parents" and no "#array_parents" exist yet, although we react upon the "Process form" event.

Using the "After build" event does not work either, as it seems it's too late to add the Ajax handler upon that event.

Proposed resolution

Remaining tasks

Fix the bug.

User interface changes

API changes

Data model changes

Edited by drupalbot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information