Php 引导窗体主题符号3

Php 引导窗体主题符号3,php,forms,twitter-bootstrap,symfony,twig,Php,Forms,Twitter Bootstrap,Symfony,Twig,我在symfony项目中使用Bootstrap 3主题,如下所示: # Twig Configuration twig: debug: "%kernel.debug%" strict_variables: "%kernel.debug%" form_themes: - 'bootstrap_3_layout.html.twig' < div class="col-xs-12 col-sm-6 col-sm-offset-3"

我在symfony项目中使用Bootstrap 3主题,如下所示:

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    form_themes:
        - 'bootstrap_3_layout.html.twig'
< div class="col-xs-12 col-sm-6 col-sm-offset-3" >
    {{ form(my_form) }}
< /div >
我想用一个
环绕我的所有表单,如下所示:

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    form_themes:
        - 'bootstrap_3_layout.html.twig'
< div class="col-xs-12 col-sm-6 col-sm-offset-3" >
    {{ form(my_form) }}
< /div >
{{表格(我的表格)}
我的Symfony应用程序中有很多表单,所以我不想在每个表单文件上都写


有没有办法覆盖一点“bootstrap_3_layout.html.twig”文件并保留其原始内容?

您可以使用自己的表单主题,它扩展并覆盖原始Symfony主题文件的一小部分


请注意,“bootstrap_3_layout.html.twig”主题文件是从另一个文件扩展而来的,因此您可能必须搜索继承树以找到要覆盖的最合适的块。

我已经尝试过了,但没有成功,我使用了{%block form%}
{parent()}
{%endblock%},我应该在这个自定义表单中写什么?如何设置
表单主题
配置,并在自己的代码中使用父级?我在“app/resources/form”中复制了“bootstrap\u 3\u layout.html.twig”文件,并在文件末尾添加了该代码