Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[FrameworkBundle] TemplateController should accept extra arguments to be sent to the template#35257
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[FrameworkBundle] TemplateController should accept extra arguments to be sent to the template#35257
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hi@Rebolon, thanks for taking care of this. I left some comments to make your "first contribution" happy :)
- The target branch must be
master
for new features (future 5.1),4.4
is already released and must be used for bugfix only. Please, rebase it tomaster
. - A functional test case is required for new features like this one.
Don't hesite to ask any question, thanks again.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@yceruto thx for help. |
Don't worry about it, I can add it at the end, just let me know when the other comments have been fixed. Thanks! |
@yceruto it should be ok right now |
Wow! you were fast ⚡ :) An unit test is enough for me, but can you confirm that this is the new route config for this feature? # config/routes.yamlacme_privacy:path:/privacycontroller:Symfony\Bundle\FrameworkBundle\Controller\TemplateControllerdefaults:template:'static/privacy.html.twig'maxAge:86400sharedAge:86400# optionally you can define some arguments passed to the templatecontext:site_name:'ACME'theme:'dark' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Look good to me after minor comment, thanks!
src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Rebolon commentedJan 9, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@yceruto That's it for the yaml config. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
with minor comment
src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
(please fix fabbot's report) |
… be sent to the template
Thank you@Rebolon. |
Uh oh!
There was an error while loading.Please reload this page.
In the official documentation (symfony.com/doc/master/templates.html#rendering-a-template-directly-from-a-route) it says that TemplateController should accept extra arguments. In fact it's not available for instance.
So i added the context argument as an array. Because of deprecation of templating, only the twig instance will apply the context argument.
It will need to be implemented in branch 5.
The following issue has been created in documentation project :symfony/symfony-docs#12897