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 10, 2024
1 parent 0513531 commit d65c516
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Actions/NotifyUsersWorkflowAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Symbiote\AdvancedWorkflow\Actions;

use SilverStripe\Control\Email\Email;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\TextareaField;
Expand All @@ -14,7 +15,8 @@
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer;
use SilverStripe\View\TemplateEngine;
use SilverStripe\View\ViewLayerData;
use Swift_RfcComplianceException;
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowAction;
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowInstance;
Expand Down Expand Up @@ -134,10 +136,7 @@ public function execute(WorkflowInstance $workflow)
]);
}


$view = SSViewer::fromString($this->EmailTemplate);
$this->extend('updateView', $view);

$engine = Injector::inst()->create(TemplateEngine::class);
foreach ($members as $member) {
if ($member->Email) {
// We bind in the assignee at this point, as it changes each loop iteration
Expand All @@ -146,7 +145,7 @@ public function execute(WorkflowInstance $workflow)
$item->Assignee = ArrayData::create($assigneeVars);
}

$body = $view->process($item);
$body = $engine->renderString($this->EmailTemplate, ViewLayerData::create($item));

$email = Email::create();
try {
Expand Down

0 comments on commit d65c516

Please sign in to comment.