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

twitter-bootstrap-3 – 遵循Bootstrap 3的手册说明,获取yml配置

发布时间:2020-12-18 00:18:25 所属栏目:安全 来源:网络整理
导读:我正在从手册直接遵循指示.我的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/bootstr
我正在从手册直接遵循指示.我的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 %}

当然也可以在base.html.twig的底部调用jquery和boostrap.js

在任何我的模板我有….

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


{% block body %} //etc. etc.

我得到错误:

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

他们是否更改了yml配置设置,而不是在手册中更新?

解决方法

在更新的Symfony版本中,您必须使用form_themes而不是form.resources:
# app/config/config.yml
twig:
    form_themes: ['bootstrap_3_layout.html.twig']

而且,您不需要将其添加到您的模板中:

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

您可以安全地删除该标签,表单仍将使用Bootstrap表单主题(因为您在config.yml文件中全局配置).

这是关于这个的官方文件:http://symfony.com/doc/2.6/cookbook/form/form_customization.html#making-application-wide-customizations

(编辑:李大同)

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

    推荐文章
      热点阅读