Compare commits

...

2 Commits

Author SHA1 Message Date
Guy Sartorelli
ab60027e91
Merge 94bd9e056d into cd1b9ed9f2 2024-10-14 03:01:59 +00:00
Guy Sartorelli
94bd9e056d
ENH Update code to reflect changes in template layer 2024-10-14 16:01:50 +13:00

View File

@ -5,6 +5,7 @@ namespace SilverStripe\ContentReview\Tasks;
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;
@ -14,7 +15,8 @@ use SilverStripe\Model\List\SS_List;
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;
@ -165,9 +167,8 @@ class ContentReviewEmails extends BuildTask
*/
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);
}
@ -176,7 +177,7 @@ class ContentReviewEmails extends BuildTask
* 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