Skip to content

Commit ba942fd

Browse files
authored
Make adding a custom template more specific
The docs are not wrong because #[AsTwigComponent('alert', 'my/custom/template.html.twig')] will indeed load the custom template. But if you are using multiple parameters: #[AsTwigComponent('alert', exposePublicProps:false, 'my/custom/template.html.twig')] Just adding a value for the template won't work. You need specify it's a template. The custom template works with the template parameter: #[AsTwigComponent('alert', exposePublicProps:false, template:'my/custom/template.html.twig')]
1 parent 6e87ef5 commit ba942fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/TwigComponent/src/Resources/doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ as the second argument to the ``AsTwigComponent`` attribute:
184184
// ...
185185
186186
- #[AsTwigComponent('alert')]
187-
+ #[AsTwigComponent('alert', 'my/custom/template.html.twig')]
187+
+ #[AsTwigComponent('alert', template: 'my/custom/template.html.twig')]
188188
class AlertComponent
189189
{
190190
// ...

0 commit comments

Comments
 (0)