diff --git a/modules/backend/formwidgets/Repeater.php b/modules/backend/formwidgets/Repeater.php index 95ac67c90..159f20c3e 100644 --- a/modules/backend/formwidgets/Repeater.php +++ b/modules/backend/formwidgets/Repeater.php @@ -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; }