todstoychev / bootstrap-alert-bundle
Symfony 扩展包,用于创建 Twitter Bootstrap 3 的警告框。
0.2.0
2018-05-15 10:35 UTC
Requires
- php: >=7.1.3
This package is not auto-updated.
Last update: 2024-09-14 19:31:26 UTC
README
使用标准方式
composer require todstoychev/bootstrap-alert-bundle
然后将其包含在您的 AppKernel.php 中
new Todstoychev\BootstrapAlertBundle\TodstoychevBootstrapAlertBundle()
由于此扩展包使用 Twitter Bootstrap 3 组件,因此它自带 Bootstrap 3.3.7 和 jQuery 3.1.1。要安装它们,只需运行
php bin/console asset:install
Symfony 会为您安装资源
还需要将名为 style.css 的文件包含到您的样式表列表中,该文件位于扩展包的 css 目录中。
配置
将以下内容添加到您的应用程序 config.yml 中
twig: globals: todstoychev_bootstrap_alert: use_close_button: true # Allows you to use close button in alert boxes use_icons: true # Show icons in alert boxes icons: error: 'glyphicon glyphicon-close-sign' warning: 'glyphicon glyphicon-exclamation-sign' info: 'glyphicon glyhicon-info-sign' success: 'glyphicon glyphicon-ok-sign'
您可以使用任何其他图标集
使用方法
只需将模板包含到您的 twig 中
{% include 'TodstoychevBootstrapAlertBundle::alert.html.twig' %}