ECA Form: multi-value option field doesn't receive correct default values

Created on 29 January 2025, 25 days ago

Problem/Motivation

For multi-value option fields, ECA determines the default value in \Drupal\eca_form\Plugin\Action\FormAddOptionsField::buildDefaultValue and uses array_keys($default_options) to extract them. This is wrong because the form values after submission are stored like this:

field_name:
  value1: value1
  value2: 0
  value3: value3
  value4: 0
  value5: 0

In this example, values 1 and 3 are selected, the other 3 aren't. But array_keys return all 5 values as if they were all selected.

Proposed resolution

Use array_values instead.

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇩🇪Germany jurgenhaas Gottmadingen

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

Comments & Activities

Production build 0.71.5 2024