Skip to content

Commit

Permalink
Merge pull request #1297 from heyday/6
Browse files Browse the repository at this point in the history
fix: prevent CMS requirements from leaking into preview email
  • Loading branch information
GuySartorelli authored Jun 23, 2024
2 parents 8831bdb + cccc3f7 commit f2cda50
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 f2cda50

Please sign in to comment.