Do minItem initialization before checking current value in repeater prep
Fixes https://github.com/octobercms/october/issues/5274
This commit is contained in:
parent
216b0d6004
commit
ed06a6f1ac
|
|
@ -248,16 +248,6 @@ class Repeater extends FormWidgetBase
|
|||
}
|
||||
}
|
||||
|
||||
if (!$this->childAddItemCalled && $currentValue === null) {
|
||||
$this->formWidgets = [];
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->childAddItemCalled && !isset($currentValue[$this->childIndexCalled])) {
|
||||
// If no value is available but a child repeater has added an item, add a "stub" repeater item
|
||||
$this->makeItemFormWidget($this->childIndexCalled);
|
||||
}
|
||||
|
||||
// Ensure that the minimum number of items are preinitialized
|
||||
// ONLY DONE WHEN NOT IN GROUP MODE
|
||||
if (!$this->useGroups && $this->minItems > 0) {
|
||||
|
|
@ -273,6 +263,16 @@ class Repeater extends FormWidgetBase
|
|||
}
|
||||
}
|
||||
|
||||
if (!$this->childAddItemCalled && $currentValue === null) {
|
||||
$this->formWidgets = [];
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->childAddItemCalled && !isset($currentValue[$this->childIndexCalled])) {
|
||||
// If no value is available but a child repeater has added an item, add a "stub" repeater item
|
||||
$this->makeItemFormWidget($this->childIndexCalled);
|
||||
}
|
||||
|
||||
if (!is_array($currentValue)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue