Download the PHP package pinano/select2-bundle without Composer
On this page you can find all versions of the php package pinano/select2-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pinano/select2-bundle
More information about pinano/select2-bundle
Files in pinano/select2-bundle
Package select2-bundle
Short Description Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg
License MIT
Homepage http://github.com/pinano/select2-bundle
Informations about the package select2-bundle
Select2 Bundle for Symfony2
Current Version
Installation
Add bundle to your composer.json file
Or, if you prefer, choose a specific version
Add bundle to your application kernel
Download the bundle using Composer
Install assets
Given your server's public directory is named "web", install the public vendor resources
Optionally, use the --symlink attribute to create links rather than copies of the resources
Usage
Once all the resources are in place you can edit any of your twig views or layouts to include the Select2 javascript files.
Select2 optionally supports multiple languages by simply including the right language javascript file
(i18n/es.js
, i18n/fr.js
, etc.) after select2.js
. In the following example we are loading the Spanish locale.
Note: Select2 requires the jQuery library.
Then you will want to load the css resources so your select elements look nice:
Note: See https://github.com/kriswallsmith/assetic/issues/53 for known limitations of assetic with CSS referencing.
I usually follow a simple inheritance schema when it comes to designing twig templates. That is, I have an app/Resources/views/base.html.twig file that I use as a site-wide template. Then, inside every bundle I have my own Resources/views/layout.html.twig file that extends the base template. Depending on the kind of application I'm designing I can place the Bootstrap stuff in the site-wide or the bundle-wide template. Then every view of a given bundle will extend the corresponding bundle layout.html.twig file, which in turn extends the site-wide template.
The folks at Sensio Labs have already covered this approach and you can check it in their documentation.
Licenses
I do not own Select2 files at all, I'm just providing a Bundle package to easy-install them all. Refer to the source code of the included files from Select2 for license information.