Allow mapping "List (string)" field type to `type: string`, with a twist: don't map the stored value, but its key/name/label

Created on 25 September 2025, about 2 months ago

Overview

Allow mapping "List (integer)" field type to `type: integer` and "List (float)" to `type: float` Needs work added support for list_float and list_integer. It documents in detail why list_string cannot be supported in a similar way.

Discussed the reasons for not supporting list_string with @lauriii, which he feels is very important.

Proposed resolution

@lauriii proposed to NOT map the actually stored string value (which would indeed cause the concerns @Wim Leers documented). But to INSTEAD use the associated human-readable label (the "key").

IOW:

There are some challenges to overcome though on the implementation front:

// @todo Allow matching `list_string` to any `type: string`, by flipping around how it works: it should NOT pass the *stored* string (the "value"), but the *human-readable label* (the "key") to a `type: string`. This will require adding a new computed property to the `list_string` field type that fetches the label ("key") from its `allowed_values` setting, translated to the current \Drupal\Core\Language\LanguageInterface::TYPE_CONTENT language, despite it being a config translation.

User interface changes

Feature request
Status

Active

Version

1.0

Component

Shape matching

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024