I have an simple HTML upload form in the image.html.twig file which is included by the base.html.twig and all the views extends this base.html.twig layout. I dont want to use the HTML way of creating the form. I have previously created form using the form builder but not in this way. How do I create a form using the form builder for this kind of problem? Do I pass the form class in each and every controller? I am having trouble creating the form because image.html.twig is included by the base.html.twig and base.html.twig is extended by all the views.
Asked
Active
Viewed 136 times
1 Answers
1
You can create an independent controller for the form (the form being in its own independent html.twig
alone), pass the form in that controller, and then render the controller inside base.html.twig
like so
{{ render(controller('nameOfMyController:method')) }}
See How to insert a Controller in Twig with "render" in Symfony 2.2? for rendering controllers in Twig.

Community
- 1
- 1

Joe Yahchouchi
- 627
- 7
- 16