From fea447644a65c353d004acbc0b59c728dc056f77 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Mon, 14 Oct 2024 15:58:01 +1300 Subject: [PATCH] ENH Update code to reflect changes in template layer --- src/Controllers/ModuleInitialisationController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Controllers/ModuleInitialisationController.php b/src/Controllers/ModuleInitialisationController.php index b8718547..e87f2e29 100644 --- a/src/Controllers/ModuleInitialisationController.php +++ b/src/Controllers/ModuleInitialisationController.php @@ -15,7 +15,8 @@ use Exception; use SilverStripe\Core\Manifest\Module; use SilverStripe\Model\ArrayData; -use SilverStripe\View\SSViewer; +use SilverStripe\View\SSTemplateEngine; +use SilverStripe\View\ViewLayerData; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -148,8 +149,8 @@ protected function initFeaturesPath(OutputInterface $output, Module $module) ); // Create dummy feature - $featureContent = ArrayData::create([]) - ->renderWith(__DIR__.'/../../templates/SkeletonFeature.ss'); + $engine = SSTemplateEngine::create(__DIR__.'/../../templates/SkeletonFeature.ss'); + $featureContent = $engine->render(ViewLayerData::create([])); file_put_contents($fullPath.'/placeholder.feature', $featureContent); } @@ -184,7 +185,8 @@ protected function initClassPath(OutputInterface $output, Module $module, $names 'Namespace' => $fullNamespace, 'ClassName' => $class, ]); - $classContent = $obj->renderWith(__DIR__.'/../../templates/FeatureContext.ss'); + $engine = SSTemplateEngine::create(__DIR__.'/../../templates/FeatureContext.ss'); + $classContent = $engine->render(ViewLayerData::create($obj)); file_put_contents($classPath ?? '', $classContent); // Log