public function initPlugin()
{
$this->app[$this->getPluginName()] = function ($app) {
$paths = $app->config('templating.paths') ?: [$app['dir.root'] . '/module/' . $app['app.module'] . '/template/%name%'];
$basePath = $app->config('templating.basePath') ?: $app->request()->getBasePath() . '/assets';
$loader = new FilesystemLoader($paths);
$engine = new PhpEngine(new TemplateNameParser(), $loader);
$engine->addGlobal('app', $app);
$engine->set(new SlotsHelper());
$engine->set(new AssetsHelper($basePath));
$app->event()->emit('plugin.templating.after', [$app, $engine]);
return $engine;
};
}