Skip to content

Commit

Permalink
Array prototype for select2 config
Browse files Browse the repository at this point in the history
  • Loading branch information
WedgeSama committed Aug 7, 2013
1 parent 1f250d7 commit 798502f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 47 deletions.
34 changes: 1 addition & 33 deletions DependencyInjection/Configuration.php
Expand Up @@ -360,39 +360,7 @@ private function addSelect2(ArrayNodeDefinition $rootNode)
->children()
->booleanNode('enabled')->defaultFalse()->end()
->arrayNode('configs')
->addDefaultsIfNotSet()
->children()
->scalarNode('placeholder')
->defaultValue('Select a value')
->end()
->scalarNode('width')
->defaultValue('off')
->validate()
->ifNotInArray(array('off', 'element', 'copy', 'resolve'))
->thenInvalid('Invalid default value "%s"')
->end()
->end()
->booleanNode('allowClear')
->defaultFalse()
->end()
->integerNode('minimumInputLength')
->defaultValue(0)
->min(0)
->end()
->integerNode('maximumInputLength')
->min(0)
->end()
->scalarNode('separator')->end()
->integerNode('minimumResultsForSearch')
->min(1)
->end()
->booleanNode('closeOnSelect')->end()
->booleanNode('openOnEnter')->end()
->booleanNode('dropdownAutoWidth')->end()
->booleanNode('selectOnBlur')->end()
->integerNode('loadMorePadding')
->min(0)
->end()
->prototype('variable')
->end()
->end()
->end()
Expand Down
18 changes: 5 additions & 13 deletions Resources/doc/jquery/select2/config.md
@@ -1,6 +1,8 @@
# jQuery Select2: Set the default configuration
# jQuery Select2 configuration

### Default configuration:
By default, just use the default configuration of select2.

### Configuration example:
``` yml
# app/config/config.yml
genemu_form:
Expand All @@ -13,15 +15,5 @@ genemu_form:
minimumInputLength: 0
```

### Other options:
- maximumInputLength
- separator
- minimumResultsForSearch
- closeOnSelect
- openOnEnter
- dropdownAutoWidth
- selectOnBlur
- loadMorePadding

see officiel select2's documentation for more information:
http://ivaynberg.github.io/select2/
http://ivaynberg.github.io/select2/#documentation
2 changes: 1 addition & 1 deletion Resources/doc/jquery/select2/index.md
Expand Up @@ -43,4 +43,4 @@ documentation.
## Extra

1. [Ajax](https://github.com/genemu/GenemuFormBundle/blob/master/Resources/doc/jquery/select2/ajax.md)
2. [Default configuration](https://github.com/genemu/GenemuFormBundle/blob/master/Resources/doc/jquery/select2/config.md)
2. [Configuration example](https://github.com/genemu/GenemuFormBundle/blob/master/Resources/doc/jquery/select2/config.md)

0 comments on commit 798502f

Please sign in to comment.