2017 © Pedro Peláez
 

symfony-bundle select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

image

pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  • Tuesday, July 25, 2017
  • by fergardi
  • Repository
  • 2 Watchers
  • 14 Stars
  • 97,102 Installations
  • JavaScript
  • 4 Dependents
  • 0 Suggesters
  • 8 Forks
  • 2 Open issues
  • 13 Versions
  • 4 % Grown

The README.md

Select2 Bundle for Symfony2

Current Version

Select2 4.0.3, (*1)

Installation

Add bundle to your composer.json file

``` js // composer.json, (*2)

{ "require": { // ... "pinano/select2-bundle": "dev-master" } }, (*3)


### Or, if you prefer, choose a specific version ``` js // composer.json { "require": { // ... "pinano/select2-bundle": "4.0.3" } }

Add bundle to your application kernel

``` php // app/AppKernel.php, (*4)

public function registerBundles() { $bundles = array( // ... new Pinano\Select2Bundle\PinanoSelect2Bundle(), // ... ); }, (*5)


### Download the bundle using Composer ``` bash $ php composer.phar update pinano/select2-bundle

Install assets

Given your server's public directory is named "web", install the public vendor resources, (*6)

``` bash $ php app/console assets:install web, (*7)


Optionally, use the --symlink attribute to create links rather than copies of the resources ``` bash $ php app/console assets:install --symlink web

Usage

Once all the resources are in place you can edit any of your twig views or layouts to include the Select2 javascript files., (*8)

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., (*9)

Note: Select2 requires the jQuery library., (*10)

``` twig {% block javascripts %} {% javascripts ... '@PinanoSelect2Bundle/Resources/public/js/select2.min.js' '@PinanoSelect2Bundle/Resources/public/js/i18n/es.js' ... %} {% endjavascripts %} {% endblock %}, (*11)


Then you will want to load the css resources so your select elements look nice: ``` twig {% block stylesheets %} {% stylesheets filter='cssrewrite' ... 'bundles/pinanoselect2/css/select2.css' ... %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} {% endblock %}

Note: See https://github.com/kriswallsmith/assetic/issues/53 for known limitations of assetic with CSS referencing., (*12)

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., (*13)

The folks at Sensio Labs have already covered this approach and you can check it in their documentation., (*14)

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., (*15)

References

  1. https://select2.github.io/
  2. http://symfony.com

The Versions

25/07 2017

dev-master

9999999-dev http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

15/11 2016

v4.0.3

4.0.3.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

03/02 2016

4.0.1

4.0.1.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

10/06 2015

3.x-dev

3.9999999.9999999.9999999-dev http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

10/06 2015

3.5.2

3.5.2.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

09/06 2015

dev-ohmer1-fix_images_paths

dev-ohmer1-fix_images_paths http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

30/04 2015

4.0.0

4.0.0.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

18/11 2013

3.4.5

3.4.5.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

28/10 2013

3.4.4

3.4.4.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

09/10 2013

3.4.3.1

3.4.3.1 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

02/10 2013

3.4.3

3.4.3.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

03/09 2013

3.4.2

3.4.2.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2

24/05 2013

3.4.0

3.4.0.0 http://github.com/pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

  Sources   Download

MIT

The Requires

 

by Fernando Arroyo

jquery bundle select2