Skip to content

Conversation

@i-just
Copy link
Contributor

@i-just i-just commented Jan 7, 2026

Description

Steps to reproduce:

  • clean 5.8.21 installation
  • create a field called “Plain Text” with a handle of plainText;
  • create two entry types: et1 and et2
  • to each, you add this plainText field 3 times:
    • once in its original form - you don’t override the label or the handle,
    • the second one’s handle is automatically overridden (handles have to be unique per layout), and you change the label to “headline”,
    • the third one’s handle is also automatically overridden, and you change the label to “topline”;
  • create three sections (can be any type, but let's stick with Singles as in the GH issue): “Single 1” with et1, “Single 2” with et2 and “Single 3” with et1
  • edit each entry and fill out the text of each of those fields with the label and handle, e.g. “plain text => plainText”, “headline => plainText2”, “topline => plainText3”

If you go to the entry index page, to the “Singles” source and click the “View” button next to the search input, you can see that the “Plain text” checkbox appears only once, since its handle is not overridden and “headline” and “topline” each show twice

How it currently works:
If you add the same field to a field layout more than once, each of those field instances gets its own checkbox in the Table Columns list, because it has an overwritten handle: https://github.com/craftcms/cms/blob/5.8.21/src/services/ElementSources.php#L458-L467; If you are adding the same field twice, it‘s safe to assume that you‘d want the label of that field to be different for each case, just like you have: “text”, “headline”, “topline”, so it all looks and works as expected.

The same rule applies when you‘re viewing a source that has multiple field layouts. If each of your singles uses a different entry type, then each field is a different instance and therefore shows as a separate checkbox.

We had a similar report for the condition builder functionality, and the most recent work was done here: #15781. In that case, we‘ll only show duplicate names of the same field if the name is the same, but the handle is different. Additionally, if the user has ‘showFieldHandles’ turned on, we‘ll show the field handles.

This PR:
This PR makes the table column checkboxes and actual table columns follow the same logic as the condition builder. Each combination of the field uid (actual global field uid), field layout element label and field layout element handle is the same - only show one checkbox table columns checkbox and only show one column for it in the table. This affects the element index table view (and inline editing), the “table columns” checkboxes under the “View” button, and the “Customize Sources” modal.

Before:
Screenshot 2026-01-07 at 15 03 03
Screenshot 2026-01-07 at 15 07 27

After:
Screenshot 2026-01-07 at 15 03 18
Screenshot 2026-01-07 at 15 07 40

Related issues

#18209

@i-just i-just requested a review from brandonkelly January 7, 2026 14:23
@brandonkelly brandonkelly merged commit 110bc55 into 5.x Jan 9, 2026
2 checks passed
@brandonkelly brandonkelly deleted the bugfix/18209-table-cols-for-multi-instance-fields branch January 9, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants