From c02181e69b4b7b060ac17959d52bf45255769f5e Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 9 Jun 2017 10:19:58 +1200 Subject: [PATCH] FIX Use configuration nesting wrapper around themed preview logic --- .../recipients/UserFormRecipientItemRequest.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/code/model/recipients/UserFormRecipientItemRequest.php b/code/model/recipients/UserFormRecipientItemRequest.php index 1d9e494..777e92a 100644 --- a/code/model/recipients/UserFormRecipientItemRequest.php +++ b/code/model/recipients/UserFormRecipientItemRequest.php @@ -21,19 +21,18 @@ class UserFormRecipientItemRequest extends GridFieldDetailForm_ItemRequest public function preview() { // Enable theme for preview (may be needed for Shortcodes) - $previous_theme_enabled = Config::inst()->get('SSViewer', 'theme_enabled'); + Config::nest(); Config::inst()->update('SSViewer', 'theme_enabled', true); - - $ret = $this->customise(new ArrayData(array( + + $content = $this->customise(new ArrayData(array( 'Body' => $this->record->getEmailBodyContent(), 'HideFormData' => $this->record->HideFormData, 'Fields' => $this->getPreviewFieldData() )))->renderWith($this->record->EmailTemplate); - - // reset theme preview value - Config::inst()->update('SSViewer', 'theme_enabled', $previous_theme_enabled); - - return $ret; + + Config::unnest(); + + return $content; } /**