[6.x] Bring back type column in relationship selector
This pull request aims to bring back the "Collection" and "Taxonomy" columns in the relationship selector.
In v5, the type column was hardcoded into the Listing component and only knew how to deal with collection and taxonomy arrays.
This PR brings it back as a "real" column called type, with a customised cell slot in the relationship selector listing. Maybe we should call it something else to avoid possible conflicts in addons? 🤔
[!NOTE] Brings back a proper
typecolumn (Collection/Taxonomy) in relationship selector listings with UI badge rendering and server-side column definitions.
- Frontend (Relationship Selector)
- Add
#cell-typeslot rendering aBadgefor thetypecolumn inresources/js/components/inputs/relationship/Selector.vue.- Pass
isColumnVisibleto table cell slots; import/registerBadge.- Backend (CP Resources)
- Make
setColumnsmethodsprotectedto allow overrides inEntriesandTerms.- Define a new listable, sortable
typecolumn inEntriesFieldtypeEntries(label: “Collection”) andTermsFieldtypeTerms(label: “Taxonomy”).- Map
typevalues inListedEntryandListedTermto the entry’s collection title or term’s taxonomy title.- Remove hardcoded
taxonomycolumn fromTerms(superseded bytype).Written by Cursor Bugbot for commit f311fe7b2665507c987ebb436e1d6c74c934116b. This will update automatically on new commits. Configure here.
Where can I test this out? I can't think of how to see Entries and Terms in the same listing 🤔
Where can I test this out? I can't think of how to see Entries and Terms in the same listing 🤔
- Create an entries/terms field, using stack selector mode. Don't limit it to a certain collection/taxonomy.
- You'll see new "Collection" / "Taxonomy" columns when you open the listing stacks.