Skip to content

Commit

Permalink
ENH Suppress deprecation notices for API we can't avoid
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Oct 14, 2024
1 parent 7466999 commit 126e672
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions code/Control/UserDefinedFormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\Form;
use SilverStripe\i18n\i18n;
use SilverStripe\ORM\ArrayList;
Expand Down Expand Up @@ -421,7 +422,9 @@ public function process($data, $form)
// Include any parsed merge field references from the CMS editor - this is already escaped
// This string substitution works for both HTML and plain text emails.
// $recipient->getEmailBodyContent() will retrieve the relevant version of the email
$emailData['Body'] = SSViewer::execute_string($recipient->getEmailBodyContent(), $mergeFields);
$emailData['Body'] = Deprecation::withSuppressedNotice(
fn () => SSViewer::execute_string($recipient->getEmailBodyContent(), $mergeFields)
);
// only include visible fields if recipient visibility flag is set
if ((bool) $recipient->HideInvisibleFields) {
$emailData['Fields'] = $visibleSubmittedFields;
Expand Down Expand Up @@ -487,10 +490,14 @@ public function process($data, $form)
if ($submittedFormField && trim($submittedFormField->Value ?? '')) {
$email->setSubject($submittedFormField->Value);
} else {
$email->setSubject(SSViewer::execute_string($recipient->EmailSubject, $mergeFields));
$email->setSubject(Deprecation::withSuppressedNotice(
fn () => SSViewer::execute_string($recipient->EmailSubject, $mergeFields)
));
}
} else {
$email->setSubject(SSViewer::execute_string($recipient->EmailSubject, $mergeFields));
$email->setSubject(Deprecation::withSuppressedNotice(
fn () => SSViewer::execute_string($recipient->EmailSubject, $mergeFields)
));
}

$this->extend('updateEmail', $email, $recipient, $emailData);
Expand Down

0 comments on commit 126e672

Please sign in to comment.