Cannot get multiple conditions with $form_display->getComponents()

Created on 3 September 2025, 3 months ago

Problem/Motivation

I have this issue where I try to fetch the components of a form display, to make a custom step progress.
But I encountered this issue where I cannot load all the conditional states of the fields in the entity form (ECK Entity 'profile') for any field. The visible-state comes through when I fetch the components using $form_display->getComponents(), but not the required-state.

Steps to reproduce

  1. Add an ECK entity 'profile' with bundle 'contact'
  2. Add a couple of fields:
    • field_is_company = boolean
    • field_salutation = text list with options
    • field_first_name = text
    • field_last_name = text
    • field_company_name = text
  3. Add field conditions for these fields based on a checkbox being enabled or disabled using the interface:
    • field_salutation ~> visible and required when field_is_company is unchecked
    • field_first_name ~> visible and required when field_is_company is unchecked
    • field_last_name ~> visible and required when field_is_company is unchecked
    • field_company_name ~> visible and required when field_is_company is checked
  4. Add a custom form display 'candidate'
  5. Create a custom class based on the form display 'candidate'.
  6. Use $form_display->getComponents() to fetch the fields in the display
  7. Check the third party settings for each field in the list of fields
  8. See there's only one conditional state when multiple have been configured

Proposed resolution

Add multiple conditional states for fields (when using $form_display->getComponents()).

Remaining tasks

None.

User interface changes

None.

API changes

Support multiple conditional states.

Data model changes

Support multiple conditional states.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇧🇪Belgium blacksnipe

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

Comments & Activities

Production build 0.71.5 2024