作者:mobiledu2502922985 | 来源:互联网 | 2023-05-19 04:16
Formhelpersform_startandform_endareusefulintwig:表单助手form_start和form_end在twig中很有用:{{form_
Form helpers form_start
and form_end
are useful in twig:
表单助手form_start和form_end在twig中很有用:
{{ form_start(form) }}
{{ form_end(form) }}
I can customise some parameters like the method
or the action
. But I need to customise others parameters like the class
or add the form-enctype
.
我可以自定义一些参数,如方法或操作。但我需要自定义其他参数,如类或添加form-enctype。
Can I do it? Should i set up it into the FormType.php
?
我可以做吗?我应该将它设置为FormType.php吗?
Since now I simply try to add my customised value to the twig
function like below:
从现在开始,我只是尝试将自定义值添加到twig函数中,如下所示:
{{ form_start(form, {'class': 'myclass', 'action': 'myaction'}) }}
// fields...
{{ form_end(form, {'render_rest': true}) }}
But in this case, for example, the class
does not appear.
但在这种情况下,例如,该类不会出现。
1 个解决方案