Skip to content

Commit 1da4824

Browse files
authoredSep 25, 2020
Stop forcing prepended 'ensuredFields' to the top of the blueprint. (#2536)
Only prepend fields when they are missing in the blueprint; don't force them to the top if they exist in the blueprint. Fixes #2173
1 parent a42c641 commit 1da4824

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed
 

‎src/Fields/Blueprint.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,10 @@ private function addEnsuredFieldToContents($contents, $ensured)
205205

206206
// Set the field config in it's proper place.
207207
if (! $imported) {
208-
if ($prepend && $exists) {
209-
$fields->forget($handle)->prepend($field);
210-
} elseif ($prepend && ! $exists) {
211-
$fields->prepend($field);
212-
} elseif ($exists) {
208+
if ($exists) {
213209
$fields->put($handle, $field);
210+
} elseif (! $exists && $prepend) {
211+
$fields->prepend($field);
214212
} else {
215213
$fields->push($field);
216214
}

0 commit comments

Comments
 (0)