Clarify why FieldConfigBase::getDataType() is 'list' and not 'field_config_base'

Created on 26 June 2023, over 1 year ago
Updated 23 July 2023, over 1 year ago

Problem/Motivation

Surfaced in #3361034, at #3361034-7: Make 'sequence' Typed Data instances return type of 'sequence' instead of 'list' .
\Drupal\Core\Field\FieldConfigBase::getDataType() (introduced in #2283977: Create a new ConfigEntity type for storing bundle-specific customizations of base fields ) looks like this:

  public function getDataType() {
    return 'list';
  }

but AFAICT this should be field_config_base!

Why? Because:

Steps to reproduce

N/A

Proposed resolution

  1. Investigate
  2. Tests + fix.

Per @borisson_ in #7

I discussed this at drupal dev days 2023. We think that this is actually not an issue. The call to getDataType here is actually about the content of what is in the field, not about the field itself. Since all (or at least most) fields are lists, returning list here is correct.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

TBD

🐛 Bug report
Status

Fixed

Version

10.1

Component
Field 

Last updated 1 day ago

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

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

Comments & Activities

Production build 0.71.5 2024