Problem/Motivation
In SqlContentEntityStorage, loadSingleCardinalityFields() and loadMultipleCardinalityFields() both choose whether a row's value is keyed under the default langcode or the row's own langcode. The single-cardinality method guards that choice with empty on the default_langcode key; the multiple-cardinality method does not. Because of that, a default-translation row whose base-table langcode differs from the computed default langcode gets keyed under a non-default langcode and is then skipped for non-translatable fields, so a non-translatable multi-value field (for example a Paragraphs field) loads zero items even though its rows exist and are not deleted. This still happens in 11.4.4.
To reproduce: on an entity type with the language module enabled and a non-translatable multiple-cardinality field, load an entity whose default-translation row langcode does not equal the computed default langcode; the field count is zero and it renders empty.
The fix is to add the same default_langcode check to the if condition in loadMultipleCardinalityFields() that loadSingleCardinalityFields() already uses. No query change is needed because the default_langcode column is already selected. Confirmed on 11.4.4: the field returns to its real item count and renders again.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| core-multiple-cardinality-field-langcode.patch | 1.46 KB | tomaston |
Comments
Comment #5
quietone commentedHi, Issues for Drupal core should be targeted to the 'main' branch, our primary development branch. Changes are made on the main branch first, and are then back ported as needed according to the Core change policies. The version the problem was discovered on should be stated in the issue summary Problem/Motivation section. Thanks.
I am restoring the standard issue template would also help other contributors.
As I read the issue summary there is no data loss so I am changing the priority.