Issue Bug Rejected

#90060Extending Site configuration TCA with any select-type field does not handle selected values

Claus Due 01/06/20, 17:19 updated 12/08/21, 21:41

Description

Problem:

Extending the pseudo-TCA configuration for “Sites” module to add a field of type “select” with multiple options allowed will not render the field with selected values.

Cause:

An explicit check for saved values NOT being an array is implemented, causing any array-like value to be completely ignored

Reasoning:

Given that:

  • Select-type fields with multiple possible options are possible
  • Such values, when saved to site configuration, are possible to store
  • The lack of “selected” status on all options causes second and subsequent saving of form to null such fields’ values

I conclude that:

  • We should not be intentionally ignoring array-like values

Solution:

  • Removing the `!is_array` check makes multi-option select fields work correctly
  • This in turn means the entire loop can be replaced with an array union

Reviews 1