From 5853cc54c4958989887cff5a5fe582b31045f150 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Thu, 10 Jan 2019 17:39:41 -0600 Subject: [PATCH] Ensure that FormWidgets are correctly initialized with previewMode even on AJAX requests --- modules/backend/behaviors/FormController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index 24996b8f9..f93871226 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -139,6 +139,11 @@ class FormController extends ControllerBehavior */ $this->formWidget = $this->makeWidget('Backend\Widgets\Form', $config); + // Setup the default preview mode on form initialization if the context is preview + if ($config->context === 'preview') { + $this->formWidget->previewMode = true; + } + $this->formWidget->bindEvent('form.extendFieldsBefore', function () { $this->controller->formExtendFieldsBefore($this->formWidget); });