From 7ccba3b750ec0bbc935bacc72c4c8dfee0233734 Mon Sep 17 00:00:00 2001 From: fabianhaef Date: Wed, 5 Aug 2026 08:59:22 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Group=20Matrix=20block=20action=20menu?= =?UTF-8?q?=E2=80=99s=20add-entry=20items=20by=20entry=20type=20group?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_components/fieldtypes/Matrix/block.twig | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/templates/_components/fieldtypes/Matrix/block.twig b/src/templates/_components/fieldtypes/Matrix/block.twig index 795774c1baf..a1ab531cde7 100644 --- a/src/templates/_components/fieldtypes/Matrix/block.twig +++ b/src/templates/_components/fieldtypes/Matrix/block.twig @@ -143,19 +143,34 @@ }) %} {% endif %} -{% set actionMenuItems = actionMenuItems|push({hr: true}) %} - {% if not staticEntries %} - {% for entryType in entryTypes %} - {% set actionMenuItems = actionMenuItems|push({ + {% set groupedEntryTypes = collect(entryTypes).groupBy(et => (et.group ?? 'General'|t('app'))) %} + {% if groupedEntryTypes.count() > 1 %} + {% set actionMenuItems = actionMenuItems|merge(groupedEntryTypes.map((entryTypes, group) => [ + {hr: true, padded: false}, + { + heading: group|t('site'), + padded: false, + items: entryTypes|map(entryType => { + icon: entryType.icon ?? 'plus', + color: entryType.color, + label: 'Add {type} above'|t('app', {type: entryType.name|t('site')}), + attributes: { + data: {action: 'add', type: entryType.handle}, + }, + }), + }, + ]).flatten(1).all()) %} + {% else %} + {% set actionMenuItems = actionMenuItems|push({hr: true})|merge(entryTypes|map(entryType => { icon: entryType.icon ?? 'plus', color: entryType.color, label: 'Add {type} above'|t('app', {type: entryType.name|t('site')}), attributes: { data: {action: 'add', type: entryType.handle}, }, - }) %} - {% endfor %} + })) %} + {% endif %} {% endif %} {% namespace baseInputName %} From ecaffb5ce33e2c07751834fc5731b141aca5a0b5 Mon Sep 17 00:00:00 2001 From: fabianhaef Date: Wed, 5 Aug 2026 08:59:33 +0200 Subject: [PATCH 2/2] Add search input to Matrix block action menu above 5 entry types --- src/templates/_components/fieldtypes/Matrix/block.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templates/_components/fieldtypes/Matrix/block.twig b/src/templates/_components/fieldtypes/Matrix/block.twig index a1ab531cde7..0f8fa593f94 100644 --- a/src/templates/_components/fieldtypes/Matrix/block.twig +++ b/src/templates/_components/fieldtypes/Matrix/block.twig @@ -273,6 +273,7 @@ {{ disclosureMenu(actionMenuItems, { hiddenLabel: 'Actions'|t('app'), + withSearchInput: not staticEntries and entryTypes|length > 5, buttonAttributes: { class: ['action-btn', 'small'], title: 'Actions'|t('app'),