Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- Fixed a bug where element search query caches weren’t getting invalidated when elements’ search keywords were indexed. ([#18275](https://github.com/craftcms/cms/issues/18275))
- Fixed a bug where disabled sites weren’t getting loaded when running Codeception tests. ([#18638](https://github.com/craftcms/cms/issues/18638))
- Fixed a bug where custom entry index page icons weren’t getting stored properly if the source name contained periods. ([#18631](https://github.com/craftcms/cms/issues/18631))
- Fixed a bug where copying nested entries on a revision wasn’t working. ([#18648](https://github.com/craftcms/cms/issues/18648))
- Fixed a bug where Matrix fields in Blocks view could have “Duplicate selected blocks” and “Delete selected blocks” field-level actions. ([#18652](https://github.com/craftcms/cms/pull/18652))

## 5.9.18 - 2026-03-26

Expand Down
5 changes: 5 additions & 0 deletions src/controllers/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,11 @@ public function actionRenderElements(): Response
->ownerId($ownerId);
}

// if we have revisionId, then we might need to look through soft-deleted elements too
if (isset($criterion['revisionId'])) {
$query->trashed(null);
}

$elements = $query->all();

// See if there are any provisional changes we should show
Expand Down
11 changes: 11 additions & 0 deletions src/controllers/ElementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,17 @@ public function actionBulkDuplicate(): ?Response
->only($element->safeAttributes())
->all();

// if element is a revision, we need to nullify some additional attributes
if ($element->getIsRevision()) {
$safeNewAttributes['revisionId'] = null;

if ($element->dateDeleted !== null) {
$safeNewAttributes['dateDeleted'] = null;
$safeNewAttributes['deletedWithOwner'] = null;
$safeNewAttributes['trashed'] = false;
}
}

try {
$newElement = $elementsService->duplicateElement(
$element,
Expand Down
18 changes: 12 additions & 6 deletions src/fields/Matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -980,12 +980,16 @@ private function blockViewActionMenuItems(): array
$entrySelector = ' > .blocks > .matrixblock';

$items[] = $this->copyAction($type, $entrySelector);
$items[] = $this->duplicateAction($type, $entrySelector, <<<JS
if (!$this->static) {
$items[] = $this->duplicateAction($type, $entrySelector, <<<JS
field.data('matrix').duplicateSelectedEntries();
JS);
$items[] = $this->deleteAction($type, $entrySelector, <<<JS
JS
);
$items[] = $this->deleteAction($type, $entrySelector, <<<JS
field.data('matrix').deleteSelectedEntries();
JS);
JS
);
}
}

return $items;
Expand All @@ -1003,10 +1007,12 @@ private function cardViewActionMenuItems(): array
$items[] = $this->copyAction($type, $entrySelector);
$items[] = $this->duplicateAction($type, $entrySelector, <<<JS
field.children('.nested-element-cards').data('nestedElementManager').duplicateElements(getEntries());
JS);
JS
);
$items[] = $this->deleteAction($type, $entrySelector, <<<JS
field.children('.nested-element-cards').data('nestedElementManager').deleteElements(getEntries());
JS);
JS
);
}

return $items;
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/web/assets/cp/src/js/CP.js
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,7 @@ Craft.CP.ElementCopyNotification = Craft.CP.Notification.extend({
type: e.type,
id: e.id,
siteId: e.siteId,
revisionId: e.revisionId ?? null,
instances: [
{
ui: 'chip',
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/matrix/dist/MatrixInput.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/matrix/dist/MatrixInput.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/matrix/src/MatrixInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@

const entryTypeIds = this.entryTypes.map((entryType) => entryType.id);
for (const info of elementInfo) {
if (!entryTypeIds.includes(info.data.entryTypeId)) {
if (!entryTypeIds.includes(info.data?.entryTypeId)) {
return false;
}
}
Expand Down
Loading