Skip to content

Commit a628f38

Browse files
authored
Merge pull request #18670 from craftcms/bugfix/18659-nested-element-duplication
nested element duplication
2 parents 3c922d7 + 97acf04 commit a628f38

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Fixed a bug where the Save button’s spinner wouldn’t appear right away when saving a nested element in a slideout. ([#18664](https://github.com/craftcms/cms/discussions/18664))
2121
- Fixed a bug where the server check script wasn’t treating GD as a requirement. ([craftcms/server-check#30](https://github.com/craftcms/server-check/issues/30))
2222
- Fixed a bug where tooltips could be instantiated multiple times within Link fields. ([#18666](https://github.com/craftcms/cms/issues/18666))
23+
- Fixed a bug where localized nested element content could be overwritten when the owner element was propagated to a new site. ([#18659](https://github.com/craftcms/cms/issues/18659))
2324

2425
## 5.9.18 - 2026-03-26
2526

src/elements/NestedElementManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ private function saveNestedElements(ElementInterface $owner): void
966966
} else {
967967
// Duplicate the elements, but **don't track** the duplications, so the edit page doesn’t think
968968
// its elements have been replaced by the other sites’ nested elements
969-
if ($owner->propagateAll || $this->propagateRequired($owner, $localizedOwner) || !empty($owner->newSiteIds)) {
969+
if ($owner->propagateAll || $this->propagateRequired($owner, $localizedOwner) || in_array($localizedOwner->siteId, $owner->newSiteIds)) {
970970
$this->duplicateNestedElements($owner, $localizedOwner, force: true);
971971
}
972972
}
@@ -1085,6 +1085,7 @@ public function duplicateNestedElements(
10851085
'primaryOwner' => $target,
10861086
'owner' => $target,
10871087
'propagating' => false,
1088+
'resaving' => false,
10881089
'sortOrder' => $element->getSortOrder(),
10891090
];
10901091

0 commit comments

Comments
 (0)