From ef3aa884c42e012d4282835b2192d35f001c6476 Mon Sep 17 00:00:00 2001 From: i-just Date: Mon, 29 Sep 2025 15:16:52 +0100 Subject: [PATCH 1/3] allow copy action for static matrix blocks --- .../_components/fieldtypes/Matrix/block.twig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/templates/_components/fieldtypes/Matrix/block.twig b/src/templates/_components/fieldtypes/Matrix/block.twig index 4278768873d..bfe87d51579 100644 --- a/src/templates/_components/fieldtypes/Matrix/block.twig +++ b/src/templates/_components/fieldtypes/Matrix/block.twig @@ -130,6 +130,20 @@ }, }) %} {% endfor %} +{% else %} + {# copy action should be available even for the "static" field - one entry type with min and max entries set to the same value #} + {% set actionMenuItems = actionMenuItems|merge([ + {hr: true}, + { + icon: 'clone-dashed', + color: 'fuchsia', + label: 'Copy'|t('app'), + attributes: { + data: {action: 'copy'}, + }, + }, + {hr: true}, + ]) %} {% endif %} {% namespace baseInputName %} From 29d37f825051b02aab43d78e2033972fedc7f07e Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 30 Sep 2025 16:35:17 -0700 Subject: [PATCH 2/3] Define Copy once --- .../_components/fieldtypes/Matrix/block.twig | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/templates/_components/fieldtypes/Matrix/block.twig b/src/templates/_components/fieldtypes/Matrix/block.twig index bfe87d51579..179dabdaf53 100644 --- a/src/templates/_components/fieldtypes/Matrix/block.twig +++ b/src/templates/_components/fieldtypes/Matrix/block.twig @@ -90,9 +90,12 @@ {% endif %} {% endif %} +{% set actionMenuItems = actionMenuItems|merge([ + {hr: true}, +]) %} + {% if not staticEntries %} {% set actionMenuItems = actionMenuItems|merge([ - {hr: true}, { icon: 'trash', label: 'Delete'|t('app'), @@ -109,17 +112,22 @@ data: {action: 'duplicate'}, }, }, - { - icon: 'clone-dashed', - color: 'fuchsia', - label: 'Copy'|t('app'), - attributes: { - data: {action: 'copy'}, - }, - }, - {hr: true}, ]) %} +{% endif %} + +{% set actionMenuItems = actionMenuItems|merge([ + { + icon: 'clone-dashed', + color: 'fuchsia', + label: 'Copy'|t('app'), + attributes: { + data: {action: 'copy'}, + }, + }, + {hr: true}, +]) %} +{% if not staticEntries %} {% for entryType in entryTypes %} {% set actionMenuItems = actionMenuItems|push({ icon: entryType.icon ?? 'plus', @@ -130,20 +138,6 @@ }, }) %} {% endfor %} -{% else %} - {# copy action should be available even for the "static" field - one entry type with min and max entries set to the same value #} - {% set actionMenuItems = actionMenuItems|merge([ - {hr: true}, - { - icon: 'clone-dashed', - color: 'fuchsia', - label: 'Copy'|t('app'), - attributes: { - data: {action: 'copy'}, - }, - }, - {hr: true}, - ]) %} {% endif %} {% namespace baseInputName %} From 9312ca9be0a2570eb1f7828a65272c78956697a8 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 30 Sep 2025 16:36:53 -0700 Subject: [PATCH 3/3] Release note [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c15b73dec77..657293843b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Fixed a bug where focus was moved to the top of the body after the final tag in a Tags field was removed. ([#17861](https://github.com/craftcms/cms/pull/17861)) - Fixed a bug where element queries weren’t handling generated field params properly, for generated fields with the same handle as custom fields. ([#17851](https://github.com/craftcms/cms/issues/17851), [#17855](https://github.com/craftcms/cms/issues/17855)) - Fixed a bug where it wasn’t possible to choose autosuggest inputs’ suggestions via mouse click. ([#17869](https://github.com/craftcms/cms/pull/17869)) +- Fixed a bug where nested entries within Matrix fields weren’t getting a “Copy” action if the field was set to the inline-editable blocks view mode and Min/Max Entries were set to 1. ([#17878](https://github.com/craftcms/cms/issues/17878)) - Fixed a styling issue. ## 5.8.17 - 2025-09-05