Group the Matrix block action menu’s “Add … above” items by entry type group - #19370
Open
fabianhaef wants to merge 2 commits into
Open
Group the Matrix block action menu’s “Add … above” items by entry type group#19370fabianhaef wants to merge 2 commits into
fabianhaef wants to merge 2 commits into
Conversation
Contributor
Author
|
There’s a follow-up discussion for #17594 in #17600 with a few community suggestions — how this PR relates to them:
|
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
Fixes #17594.
In the
blocksview mode, each Matrix block’s action menu appends one “Add {type} above” item per entry type, in one flat list — also reported in #17594. We have Matrix fields with 35+ entry types, and the menu becomes a long scrolling list where the only way to find a type is to read every row.The field’s “+” button already solves this:
create-button.twiggroups the same entry types by their entry type group and shows a search input above five types. This PR brings the block action menu in line with it:collect().groupBy()and{hr, padded: false}/{heading, padded: false, items}structure ascreate-button.twig. Fields with a single group (or no groups set) render exactly as before.withSearchInput: not staticEntries and entryTypes|length > 5), same threshold as the create button. The search filters all menu items (Collapse, Delete, …), like other searchable disclosure menus — it’s a separate commit so it can be dropped if that’s not wanted.Drive-by: the trailing
{hr: true}is now only added when add items follow, removing a dangling separator at the end of the menu for static blocks (e.g. revision view).Testing
staticEntries): no add items, no search input, no trailing separator.maxEntriesreached:DisclosureMenu.updateVisibility()hides the emptied groups including their headings.