Skip to content

Commit

Permalink
Delete trees when setting a collection to not orderable (#3901)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurperton authored Jul 14, 2021
1 parent ff020b0 commit 8f5dfb3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Http/Controllers/CP/Collections/CollectionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ public function update(Request $request, $collection)
}

if (! $values['structured']) {
if ($structure = $collection->structure()) {
$structure->trees()->each->delete();
}
$collection->structure(null);
} else {
$collection->structure($this->makeStructure($collection, $values['max_depth'], $values['expects_root'], $values['sites'] ?? null));
Expand Down

0 comments on commit 8f5dfb3

Please sign in to comment.