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 db09634 commit 4c6a86d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion 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\Dev\Deprecation;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\TextareaField;
Expand Down Expand Up @@ -135,7 +136,7 @@ public function execute(WorkflowInstance $workflow)
}


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

foreach ($members as $member) {
Expand Down
8 changes: 5 additions & 3 deletions src/Admin/WorkflowDefinitionExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ public function export()
*/
public function format($templateData)
{
$viewer = SSViewer::execute_template(['type' => 'Includes', 'WorkflowDefinitionExport'], $templateData);
// Temporary until we find the source of the replacement in SSViewer
$processed = str_replace('&', '&', $viewer ?? '');
$viewer = SSViewer::create(['type' => 'Includes', 'WorkflowDefinitionExport']);
$viewer->setRewriteHashLinks(false);
$viewer->includeRequirements(false);
// str_replace is temporary until we find the source of the replacement in SSViewer
$processed = str_replace('&', '&', $viewer->process($templateData));
// Clean-up newline "gaps" that SSViewer leaves behind from the placement of template control structures
return preg_replace("#^\R+|^[\t\s]*\R+#m", '', $processed ?? '');
}
Expand Down

0 comments on commit 4c6a86d

Please sign in to comment.