[5.x] Add collection title to select field #9749
Closed
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.
When you use the Entries fieldtype, and configure it to use multiple specific Collections, the list of Entries returned has no reference to what Collection they are from.
For example, if your site has multiple "sections", each within their own Collection, and each that have an "About" page, the Select box would show:
This is not useful to an author.
You can work around this using the Stack view, but is not as elegant (and requires more clicks).
This PR adds a span if the field is configured to have more than one Collection, and the Collection data exists:
If you do not configure specific Collections to use, there is no change.
If you only have a single specific Collection, there is no change.
This only kicks in when you have multiple Collections configured, or the
options
array has data for more than one Collection, and is ideal for single selection only.This does raise some questions about bigger picture UX though.
When "Select" and max of 1, the option that appears in the select box when chosen does not have Collection data.
When "Select" and multiple allowed, the
items
array does not include Collection data.So while this PR improves UX for selection, there is still room to grow further for multiple selections.