From 3b5ba1f18fd92ed11d8bdc85c148ce604f5aa051 Mon Sep 17 00:00:00 2001 From: Thomas Templeton Date: Fri, 25 Jan 2019 21:33:05 +1100 Subject: [PATCH] Fix #179 --- CHANGELOG.md | 4 ++++ composer.json | 2 +- package.json | 2 +- src/services/Fields.php | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d6843d3..faaf501f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.1.7 - 2019-01-25 +### Fixed +- Fixed issue where Neo blocks would not appear on duplicated entries + ## 2.1.6 - 2019-01-24 ### Fixed - Fixed error when pasting or cloning blocks on single-site Craft installations diff --git a/composer.json b/composer.json index 00f3a745..2542c0e2 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "spicyweb/craft-neo", "description": "A Matrix-like field type that uses existing fields", - "version": "2.1.6", + "version": "2.1.7", "type": "craft-plugin", "keywords": [ "cms", diff --git a/package.json b/package.json index f35641fe..ef8997c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "craft-neo", - "version": "2.1.6", + "version": "2.1.7", "description": "A Matrix-like field type that uses existing fields", "main": "webpack.config.js", "scripts": { diff --git a/src/services/Fields.php b/src/services/Fields.php index 591536e9..14482795 100644 --- a/src/services/Fields.php +++ b/src/services/Fields.php @@ -226,7 +226,7 @@ public function saveValue(Field $field, ElementInterface $owner, bool $isNew) $blockIds = []; - foreach ($blocks as $block) + foreach ($blocks as &$block) { if ($duplicateBlocks) { @@ -251,6 +251,8 @@ public function saveValue(Field $field, ElementInterface $owner, bool $isNew) $blockIds[] = $block->id; } + unset($block); + // Now find any blocks that need to be deleted // The blocks need to be returned in reverse order, as trying to delete them in regular order can // cause a level-related SQL error