Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Craft CMS 5

## Unreleased

- Fixed a bug where bulk entry moves could assign entries to sections that didn’t support their entry types. ([#19268](https://github.com/craftcms/cms/pull/19268))

## 5.10.11 - 2026-07-15

- Added `craft\gql\base\MutationResolver::requireAllowedSite()`.
Expand Down
9 changes: 8 additions & 1 deletion src/controllers/EntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public function actionMoveToSectionModalData(): Response

$sectionEntryTypes = array_map(fn($et) => $et->id, $section->entryTypes);

return !empty(array_intersect($entryTypes, $sectionEntryTypes));
return !empty($entryTypes) && empty(array_diff($entryTypes, $sectionEntryTypes));
})
->sortBy(fn(Section $section) => $section->getUiLabel())
->all();
Expand Down Expand Up @@ -491,6 +491,13 @@ public function actionMoveToSection(): Response
}
}

$sectionEntryTypeIds = array_map(fn($entryType) => $entryType->id, $section->getEntryTypes());
$entryTypeIds = array_unique(array_map(fn(Entry $entry) => $entry->typeId, $entries));

if (!empty(array_diff($entryTypeIds, $sectionEntryTypeIds))) {
throw new BadRequestHttpException('Not all entries have a type supported by the target section.');
}

$errors = [];
foreach ($entries as $entry) {
try {
Expand Down
6 changes: 6 additions & 0 deletions src/services/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,12 @@ public function moveEntryToSection(Entry $entry, Section $section): bool
throw new Exception('Attempting to move a nested element.');
}

$sectionEntryTypeIds = array_map(fn($entryType) => $entryType->id, $section->getEntryTypes());

if (!in_array($entry->typeId, $sectionEntryTypeIds, true)) {
throw new Exception('Entry type is not supported by the target section.');
}

// Ensure all fields have been normalized
$entry->getFieldValues();

Expand Down
Loading