加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Symfony 3.1中的Bootstrap表单主题

发布时间:2020-12-18 00:24:53 所属栏目:安全 来源:网络整理
导读:我想知道如何包含为Bootstrap 3设计的表单主题.这个选项是在Symfony 2.6中引入的,但在Symfony 3.1中它被移动或删除,因为这个解决方案不能正常工作: New in Symfony 2.6: Bootstrap form theme. 当我试图设置: twig:debug: "%kernel.debug%"strict_variable
我想知道如何包含为Bootstrap 3设计的表单主题.这个选项是在Symfony 2.6中引入的,但在Symfony 3.1中它被移动或删除,因为这个解决方案不能正常工作: New in Symfony 2.6: Bootstrap form theme.

当我试图设置:

twig:
debug:            "%kernel.debug%"
strict_variables: "%kernel.debug%"
form:
    resources: ['bootstrap_3_layout.html.twig']

我收到了这条消息:

Fatal error: Uncaught exception ‘SymfonyComponentConfigDefinitionExceptionInvalidConfigurationException’ with message ‘Unrecognized option “form” under “twig”‘ in …

我知道

{% form_theme form 'bootstrap_3_layout.html.twig' %}

它工作得很好,但我想在配置文件中永久设置这个主题.

解决方法

我认为配置密钥已更改.

试试:

# app/config/config.yml
twig:
    form_themes:
        - 'bootstrap_3_layout.html.twig'
    # ...

http://symfony.com/doc/current/cookbook/form/form_customization.html#twig

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读