How to make form_rest() not display a field with Symfony2?

前端 未结 4 475
轮回少年
轮回少年 2020-12-02 08:52

I\'ve started to use Symfony2 but I\'ve some problems. I wanted to render fields by hand but it doesn\'t work because my field yet rendered by me is displayed with the

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 09:01

    Another in my opinion less hacky way to do it is this:

    {{ form_widget(form._token) }} // render the CSRF Token
    {{ form_end(form, {'render_rest': false}) }} // do not render anything else
    

    It's from the official documentation (v3.0) so it's pretty much best practise i guess.

提交回复
热议问题