Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Update code to reflect changes in template layer #287

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Controllers/ModuleInitialisationController.php
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating to explicitly use SSTemplateEngine to render the templates, since the files being used are hardcoded paths and can't be overridden.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down
Loading