diff --git a/CHANGELOG.md b/CHANGELOG.md index 6abac8d7417..2205e757f39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Fixed multiple issues with Selectize inputs. - Fixed a bug where Command/Ctrl + clicks on “New entry” button menu options would open the Entries index page in a new tab, and redirect to the Edit Entry page in the current tab. ([#13550](https://github.com/craftcms/cms/issues/13550)) - Fixed a bug where autosuggest fields weren’t mouse-selectable. ([#13553](https://github.com/craftcms/cms/issues/13553)) +- Fixed a bug where `craft\events\MoveElementEvent::$targetElementId` was getting set incorrectly. ([#13552](https://github.com/craftcms/cms/issues/13552)) ## 4.5.0-beta.1 - 2023-08-10 diff --git a/src/events/MoveElementEvent.php b/src/events/MoveElementEvent.php index c0ee73f89e0..951e526aaff 100644 --- a/src/events/MoveElementEvent.php +++ b/src/events/MoveElementEvent.php @@ -62,7 +62,6 @@ public function getTargetElement(): ?ElementInterface ->site('*') ->preferSites([$this->element->siteId]) ->status(null) - ->status(null) ->drafts(null) ->provisionalDrafts(null) ->revisions(null) diff --git a/src/services/Structures.php b/src/services/Structures.php index 37513e5d1e8..404b21c482f 100644 --- a/src/services/Structures.php +++ b/src/services/Structures.php @@ -532,7 +532,7 @@ private function _doIt(int $structureId, ElementInterface $element, StructureEle self::MODE_UPDATE => [self::EVENT_BEFORE_MOVE_ELEMENT, self::EVENT_AFTER_MOVE_ELEMENT], }; - $targetElementId = $targetElementRecord->isRoot() ? null : $targetElementRecord->id; + $targetElementId = $targetElementRecord->isRoot() ? null : $targetElementRecord->elementId; if ($this->hasEventHandlers($beforeEvent)) { // Fire a 'beforeInsertElement' or 'beforeMoveElement' event