Skip to content

Commit

Permalink
ENH Update code to reflect changes in template layer
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Oct 14, 2024
1 parent cd1b9ed commit 94bd9e0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Tasks/ContentReviewEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Page;
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
use SilverStripe\Control\Email\Email;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\BuildTask;
use SilverStripe\PolyExecution\PolyOutput;
use SilverStripe\Model\List\ArrayList;
Expand All @@ -14,7 +15,8 @@
use SilverStripe\Security\Member;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer;
use SilverStripe\View\TemplateEngine;
use SilverStripe\View\ViewLayerData;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;

Expand Down Expand Up @@ -165,9 +167,8 @@ protected function notifyOwner($ownerID, SS_List $pages)
*/
protected function getEmailBody($config, $variables)
{
$template = SSViewer::fromString($config->ReviewBody);
$value = $template->process(ArrayData::create($variables));

$engine = Injector::inst()->create(TemplateEngine::class);
$value = $engine->renderString($config->ReviewBody, ViewLayerData::create(ArrayData::create($variables)));
// Cast to HTML
return DBField::create_field('HTMLText', (string) $value);
}
Expand All @@ -176,7 +177,7 @@ protected function getEmailBody($config, $variables)
* Gets list of safe template variables and their values which can be used
* in both the static and editable templates.
*
* {@see ContentReviewAdminHelp.ss}
* see ContentReviewAdminHelp template
*
* @param Member $recipient
* @param SiteConfig $config
Expand Down

0 comments on commit 94bd9e0

Please sign in to comment.