bake
bake copied to clipboard
Custom helpers for twig templates
Custom helpers for twig templates could be needed when user want to add more logic to templates, which is not possible to implement in twig templates.
We can consider two options:
- Find way to pass custom helper list in TemplateRenderer layer.
- Allow to define custom TemplateRenderer class which loaded in all commands.
Lets discuss what is the best way to add this feature.
We could add a BakeCommand::templateRenderer()
which returns the renderer instance so people can use $this->templateRenderer()->viewBuilder()
in execute()
(or any other method) to setup the view builder.
You can handle the bake init event to add helpers, but it doesn't let you customize the view builder before creating.