rc2c / form-twitter-bundle
Implementation of Bootstrap Form Types for Symfony 2
Installs: 3 500
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 1
Requires
- php: >=5.3
- symfony/form: >=2.1
- symfony/framework-bundle: >=2.1
This package is not auto-updated.
Last update: 2025-05-10 16:53:57 UTC
README
This bundle provides symfony 2 form types powered by twitter bootstrap.
Requirements
- Symfony 2.x
- Twitter bootstrap and jquery already loaded in your layout
Installation
Add the repository to your composer.json
"rc2c/form-twitter-bundle": "dev-master"
Run Composer to install the bundle
php composer.phar update rc2c/form-twitter-bundle
Enable the bundle in AppKernel.php
new Rc2c\FormTwitterBundle\Rc2cFormTwitterBundle(),
Multiselect
The Bootstrap Multiselect jquery plugin present in this bundle is from davidstutz. Use the new form type in a buildForm method in remplacement of a choice type
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('my_choices', 'multiselectchoice', array( 'label' => ' ', 'read_only' => true, 'choices' => array(...) )) ; }
You can set some options to change the behaviour of the widget :
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 )