From faf2156eafb528be2d72427b28fd63ee39c36575 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Sat, 20 Oct 2018 14:32:16 -0700 Subject: [PATCH] Backport 4c4020487c78b58403e3764cf1783c9012c66fe9 for Craft 2 (#2824) --- CHANGELOG-v2.md | 1 + src/services/SectionsService.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-v2.md b/CHANGELOG-v2.md index ffd73fbe439..2afeb8ce77a 100644 --- a/CHANGELOG-v2.md +++ b/CHANGELOG-v2.md @@ -3,6 +3,7 @@ ## Unreleased ### Changed +- Single sections’ entry types’ handles are now updated to match their section’s handle whenever the section is saved. ([#2824](https://github.com/craftcms/cms/issues/2824)) - Updated Garnish to 0.1.28. - Animated gif thumbnails are no longer animated. ([#3110](https://github.com/craftcms/cms/issues/3110)) - From now on an exception will be thrown if an asset if uploaded sucecssfully, but the record couldn't be saved. diff --git a/src/services/SectionsService.php b/src/services/SectionsService.php index bec97e8469e..d859b9e242c 100644 --- a/src/services/SectionsService.php +++ b/src/services/SectionsService.php @@ -602,10 +602,14 @@ public function saveSection(SectionModel $section) if (!$isNewSection) { // Re-save the entrytype name if the section name just changed - if (!$isNewSection && $oldSection->name != $section->name) + if (!$isNewSection && ( + $oldSection->name != $section->name || + $oldSection->handle != $section->handle + )) { $entryType = $this->getEntryTypeById($entryTypeId); $entryType->name = $section->name; + $entryType->handle = $section->handle; $this->saveEntryType($entryType); }