diff --git a/CHANGELOG.md b/CHANGELOG.md index 40f3297..b8d206e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 2.2.2 - 2024-06-10 +### Fixed +- Fixed an incompatibility issue with Craft 5.2, which could trigger a PHP exception when attempting to create a new child for "Edited" elements + ## 2.2.1 - 2024-05-31 ### Fixed - Fixed a misalignment issue with "New child" buttons in element index columns diff --git a/composer.json b/composer.json index 8ecccbc..86f0d4c 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "mmikkel/child-me", "description": "Easily create child elements", "type": "craft-plugin", - "version": "2.2.1", + "version": "2.2.2", "keywords": [ "craft", "cms", diff --git a/src/ChildMe.php b/src/ChildMe.php index 5593006..281d743 100644 --- a/src/ChildMe.php +++ b/src/ChildMe.php @@ -190,7 +190,7 @@ private function _renderChildMeButtonForEntry(Entry $entry): string return [ 'url' => UrlHelper::cpUrl("entries/$section->handle/new", [ 'site' => $entry->getSite()?->handle, - 'parentId' => $entry->id, + 'parentId' => $entry->canonicalId, 'typeId' => $entryType->id, ]), 'label' => $entryType->name, @@ -233,7 +233,7 @@ private function _renderChildMeButtonForCategory(Category $category): string 'links' => [[ 'url' => UrlHelper::cpUrl("categories/$group->handle/new", [ 'site' => $category->getSite()?->handle, - 'parentId' => $category->id, + 'parentId' => $category->canonicalId, ]) ]], 'element' => $category,