Fix duplicated Content Block nested fields in element index columns#19197
Merged
brandonkelly merged 1 commit intoJul 2, 2026
Merged
Conversation
f3578c5 to
bd5c521
Compare
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the same Content Block field is used in the field layouts of multiple entry types within one section, the entry index’s Table Columns picker (under the “View” button) lists each of the Content Block’s nested fields once per entry type. With, say, 10 entry types sharing one Content Block field, every nested field shows up 10 times, making it impossible to tell which one to pick.
Ordinary fields shared across multiple layouts are already deduplicated for table columns — that was added in #18220 (for #18209), mirroring the condition-builder work in #15781. Content Block fields were never included in that dedup, so their nested fields still multiply.
Steps to reproduce
This PR
Applies the same treatment #18220 gave multi-instance fields, to Content Block fields:
ElementSources::getTableAttributesForFieldLayouts()— Content Block instances are now grouped across the source’s field layouts by field UID + effective handle ($groupedContentBlocks), so each nested field is contributed once, keyed off a single representative layout element.Element::contentBlockAttributeHtml()— because the deduplicated column key now references one representative layout element UID (which may belong to a different entry type’s layout than the element being rendered), a new private helper_contentBlockFieldFromLayoutElementUid()resolves the Content Block field by field UID + effective handle within the element’s own layout. This parallels the existing_getFieldFromAlternativeLayouts()used for multi-instance fields, but matches on the effective handle (that method matches the raw layout-element handle override, which is null for non-overridden Content Blocks).Card and thumbnail rendering are intentionally untouched: those paths resolve against each element’s own layout using per-entry-type card config keys, so they never hit the cross-layout case.
Related