From d164145229ce5d676e0345a16d8eebb9832bbbcc Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 1 Nov 2017 14:18:41 -0600 Subject: [PATCH] Fixes #2613 This fixes #2613 by reloading the form widgets with the modified data after `model.filterFields`. **NOTE**: `$this->processExistingItems()` isn't simply just moved to `prepareVars()` because that messes up the adding new repeater item functionality by repeating the content from the fields for the last item in that group that already exists on the repeater. --- modules/backend/formwidgets/Repeater.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/backend/formwidgets/Repeater.php b/modules/backend/formwidgets/Repeater.php index efec0c143..788725ab4 100644 --- a/modules/backend/formwidgets/Repeater.php +++ b/modules/backend/formwidgets/Repeater.php @@ -120,6 +120,12 @@ class Repeater extends FormWidgetBase */ public function prepareVars() { + // Refresh the loaded data to support being modified by filterFields + // @see https://github.com/octobercms/october/issues/2613 + if (!self::$onAddItemCalled) { + $this->processExistingItems(); + } + if ($this->previewMode) { foreach ($this->formWidgets as $widget) { $widget->previewMode = true;