Add a label "other value" on the _other option, fix #323

[ci skip]
This commit is contained in:
Julien Fastré 2014-11-14 12:13:05 +01:00
parent ce314899a8
commit aa16bdcbb9
2 changed files with 3 additions and 5 deletions

View File

@ -19,7 +19,7 @@ class ChoiceWithOtherType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
//add an 'other' entry in choices array
$options['choices']['_other'] = '__other__';
$options['choices']['_other'] = 'Other value';
//ChoiceWithOther must always be expanded
$options['expanded'] = true;

View File

@ -95,13 +95,11 @@ jQuery(document).ready(initialize_{{ form.vars.id }}('ul_' + '{{ form.vars.id }}
{% block choice_with_other_widget %}
<div {{ block('widget_container_attributes') }}>
{%- for child in form.children._choices %}
{%- if child.vars.value == '_other' -%}
{{- form_widget(child) -}} {{- form_widget(form.children._other) -}}
{%- else -%}
{{- form_widget(child) -}}
{{- form_label(child) -}}
{%- if child.vars.value == '_other' -%}
{{- form_widget(form.children._other) -}}
{%- endif -%}
{% endfor -%}
</div>