Skip to content

Commit

Permalink
Backport 4c40204 for Craft 2
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Oct 20, 2018
1 parent e548784 commit faf2156
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion src/services/SectionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit faf2156

Please sign in to comment.