From cccc3f7ec3d97308541efc2549c341fa9c935c47 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Fri, 31 May 2024 10:22:16 +1200 Subject: [PATCH] fix: prevent CMS requirements from leaking into preview email --- code/Model/Recipient/UserFormRecipientItemRequest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/Model/Recipient/UserFormRecipientItemRequest.php b/code/Model/Recipient/UserFormRecipientItemRequest.php index 38fe2b5..f836180 100644 --- a/code/Model/Recipient/UserFormRecipientItemRequest.php +++ b/code/Model/Recipient/UserFormRecipientItemRequest.php @@ -9,6 +9,7 @@ use SilverStripe\ORM\FieldType\DBField; use SilverStripe\UserForms\Model\EditableFormField\EditableFormHeading; use SilverStripe\UserForms\Model\EditableFormField\EditableLiteralField; use SilverStripe\View\ArrayData; +use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; /** @@ -34,14 +35,18 @@ class UserFormRecipientItemRequest extends GridFieldDetailForm_ItemRequest Config::nest(); Config::modify()->set(SSViewer::class, 'theme_enabled', true); + Requirements::clear(); + $content = $this->customise([ 'Body' => $this->record->getEmailBodyContent(), 'HideFormData' => (bool) $this->record->HideFormData, 'Fields' => $this->getPreviewFieldData() ])->renderWith($this->record->EmailTemplate); + Requirements::restore(); Config::unnest(); + return $content; }