Skip to content

Make adding a custom template more specific #309

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

Merged
merged 1 commit into from
Apr 22, 2022
Merged

Make adding a custom template more specific #309

merged 1 commit into from
Apr 22, 2022

Conversation

htmlshaman1
Copy link
Contributor

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')]

Q A
Bug fix? yes/no
New feature? yes/no
Tickets Fix #...
License MIT

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')]
Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

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

Good idea, makes the examples consistent.

@weaverryan
Copy link
Member

I like this too - thanks @htmlshaman1!

@weaverryan weaverryan merged commit a02daec into symfony:2.x Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants