fergardi/select2-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Select2 resources bundle

Installs: 1 074

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0

Language:JavaScript

Type:symfony-bundle

3.4.2 2013-09-05 11:54 UTC

This package is not auto-updated.

Last update: 2017-01-26 07:45:10 UTC


README

Current Version

Select2 3.4.2 (31)

Installation

Add bundle to your composer.json file

// composer.json

{
    "require": {
        // ...
        "fergardi/select2-bundle": "dev-master"
    }
}

Add bundle to your application kernel

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Fergardi\Select2Bundle\FergardiSelect2Bundle(),
        // ...
    );
}

Download the bundle using Composer

$ php composer.phar update fergardi/select2-bundle

Install assets

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

$ php app/console assets:install web

Optionally, use the --symlink attribute to create links rather than copies of the resources

$ php app/console assets:install --symlink web

Notes: All the urls of the original routes have been changed to '../images/*' due to Bundle package requirements.

Usage

Once you have imported all the resources to the vendor folder, you can self-import the JS into your Symfony project as usual with:

{# block js #}
{% block javascripts %}
    {% javascripts filter='cssrewrite' output='js/base.js'
        ...
        '@FergardiSelect2Bundle/Resources/public/js/select2.min.js'
        '@FergardiSelect2Bundle/Resources/public/js/select2_locale_XX.js'
        ...
        %}
        <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
{% endblock %}

And with the CSS as well using with:

{# block css #}
{% block stylesheets %}
    {% stylesheets filter='cssrewrite' output='css/base.css'
        ...
        'bundles/fergardiselect2/css/select2.css'
        ...
        %}
        <link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

Note: See https://github.com/kriswallsmith/assetic/issues/53 for known limitations of assetic with CSS referencing.

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.

References

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