Problem/Motivation
#3552528 changed EntityReferenceBrowserWidget::displayCurrentSelection() so that cardinality-1 fields get entities-list--single-item instead of entities-list, rather than as an additional modifier. Gin's own CSS (entity_browser.scss) was already written expecting both classes together — e.g. .entities-list:not(.entities-list--single-item) and .entities-list.entities-list--single-item .item-container only match when entities-list is still present. With it dropped, every rule scoped under .entities-list .item-container — remove/replace/edit button positioning, item border, hover states — stops applying to single-cardinality fields (e.g. a hero image field), even though the original squishing bug is fixed.
Affected version: 2.17
Steps to reproduce
Field with cardinality 1 using the Entity Browser entity_reference widget, Gin as the admin theme, an item selected. Remove/edit buttons render unstyled and inline instead of as positioned circular icons overlaying the thumbnail.
Proposed resolution
Keep `entities-list` unconditional; add `entities-list--single-item` as a modifier only, e.g.:
$classes = ['entities-list'];
if ($this->getCardinality() != 1) {
$classes[] = 'sortable';
}
else {
$classes[] = 'entities-list--single-item';
}| Comment | File | Size | Author |
|---|---|---|---|
| entity_browser-restore-entities-list-base-class-for-single-item.patch | 978 bytes | yevko |
Comments
Comment #2
tvalimaa commentedReviewed the patch and it looks good to me.
The fix correctly restores entities-list as an unconditional base class while keeping
entities-list--single-itemas an additive modifier. This means single-cardinality fields now render with both classes which is what themes like Gin expect when using compound selectors such as.entities-list.entities-list--single-item.