rc2c / form-twitter-bundle
Symfony 2 的 Bootstrap 表单类型实现
dev-master
2015-10-21 10:20 UTC
Requires
- php: >=5.3
- symfony/form: >=2.1
- symfony/framework-bundle: >=2.1
This package is not auto-updated.
Last update: 2024-09-28 14:08:44 UTC
README
此包提供了由 Twitter Bootstrap 驱动的 symfony 2 表单类型。
要求
- Symfony 2.x
- Twitter Bootstrap 和 jQuery 已加载到您的布局中
安装
将仓库添加到您的 composer.json 文件中
"rc2c/form-twitter-bundle": "dev-master"
运行 Composer 安装包
php composer.phar update rc2c/form-twitter-bundle
在 AppKernel.php 中启用包
new Rc2c\FormTwitterBundle\Rc2cFormTwitterBundle(),
多选
此包中包含的 Bootstrap 多选 jQuery 插件来自 davidstutz。在 buildForm 方法中使用新表单类型代替选择类型
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('my_choices', 'multiselectchoice', array( 'label' => ' ', 'read_only' => true, 'choices' => array(...) )) ; }
您可以设置一些选项来更改小部件的行为
array( 'btnSelectAll' => false, // (default: true) Disables the "select all" button 'buttonClass' => 'btn-primary', // (default : "btn") Set the class of the dropdown button 'maxHeight' => 450, // (default: false) Set a max height of the dropdown list )