makinacorpus/autocomplete-bundle

Name: autocomplete-bundle

Owner: Makina Corpus

Description: Autocomplete widget and form type for Symfony

Created: 2016-10-18 08:25:55.0

Updated: 2016-10-18 08:26:10.0

Pushed: 2017-06-02 10:16:43.0

Homepage: null

Size: 16

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Autocomplete widget and form type for Symfony

This is a very early release, this package is far from being complete and provide minimal functionnalities as of today.

Installation

oser require makinacorpus/autocomplete-bundle

This autocomplete widget works with the select2 library, it is your responsability to ensure the javascript is correctly loaded for it to work.

You also need jQuery installed (sorry, this might change later).

Register the routing.yml file in your app/routing.yml file:

complete:
resource: "@AutocompleteBundle/Resources/config/routing.yml"
prefix: /

And the associated form theme in your app/config.yml file:

:
debug:            "%kernel.debug%"
strict_variables: false
form_themes:
    # ...
    - "AutocompleteBundle:Form:fields.html.twig"

And it should probably work.

Usage

First, implement an MakinaCorpus\AutocompleteBundle\Autocomplete\AutocompleteSourceInterface class, that is meant to reflect the business objects in which to autocomplete.

Then just use the MakinaCorpus\AutocompleteBundle\Form\Type\TextAutocompleteType form type in your own form builders, and set the source class name as the source parameter for the form type.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.