Skip to content

Commit

Permalink
fix: prevent CMS requirements from leaking into preview email
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Jun 23, 2024
1 parent b429efb commit cccc3f7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/Model/Recipient/UserFormRecipientItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\UserForms\Model\EditableFormField\EditableFormHeading;
use SilverStripe\UserForms\Model\EditableFormField\EditableLiteralField;
use SilverStripe\View\ArrayData;
use SilverStripe\View\Requirements;
use SilverStripe\View\SSViewer;

/**
Expand All @@ -34,14 +35,18 @@ public function preview()
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;
}

Expand Down

0 comments on commit cccc3f7

Please sign in to comment.