Twitter bootstrap 3 以下是引导程序3表单获取yml配置错误的手动说明

Twitter bootstrap 3 以下是引导程序3表单获取yml配置错误的手动说明,twitter-bootstrap-3,twig,symfony,Twitter Bootstrap 3,Twig,Symfony,我直接按照手册上的说明做。我在config.yml中有这个配置设置 twig: form: resources: ['bootstrap_3_layout.html.twig'] 还没到这一步,但在我的base.html.twig中我有 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"

我直接按照手册上的说明做。我在config.yml中有这个配置设置

twig:
    form:
        resources: ['bootstrap_3_layout.html.twig']
还没到这一步,但在我的base.html.twig中我有

    <link rel="stylesheet" 
          href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" 
          integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" 
          crossorigin="anonymous">

    <!-- Optional theme -->
    <link rel="stylesheet" 
          href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" 
          integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" 
          crossorigin="anonymous">
    {% block stylesheets %}{% endblock %}
我得到一个错误:

InvalidConfigurationException in ArrayNode.php line 317:
Unrecognized option "form" under "twig"

他们是否更改了yml配置设置,而没有在手册中进行更新?

可能文档与相关框架版本一致

试试这个:

config.yml

twig:
    form:
        resources: ['bootstrap_3_layout.html.twig']
请查看此处,以查看相关捆绑包配置的完整文档


希望获得此帮助

在较新的Symfony版本中,您必须使用
表单主题
而不是
表单。参考资料

# app/config/config.yml
twig:
    form_themes: ['bootstrap_3_layout.html.twig']
而且,您不需要将此添加到模板中:

{% form_theme form 'bootstrap_3_layout.html.twig' %}
您可以安全地删除该标记,表单仍将使用引导表单主题(因为您在
config.yml
文件中全局配置了它)


这是关于这一点的官方文档:

感谢您提供关于不需要在块中包含表单主题的额外信息。这是一个很好的3.0版,感谢快速响应,并教我更多关于yml语法的知识,因为您和@Javier以上的答案都是正确的。
{% form_theme form 'bootstrap_3_layout.html.twig' %}