mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 06:14:23 +00:00
parent
ce314899a8
commit
aa16bdcbb9
@ -19,7 +19,7 @@ class ChoiceWithOtherType extends AbstractType
|
|||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
//add an 'other' entry in choices array
|
//add an 'other' entry in choices array
|
||||||
$options['choices']['_other'] = '__other__';
|
$options['choices']['_other'] = 'Other value';
|
||||||
//ChoiceWithOther must always be expanded
|
//ChoiceWithOther must always be expanded
|
||||||
$options['expanded'] = true;
|
$options['expanded'] = true;
|
||||||
|
|
||||||
|
@ -95,13 +95,11 @@ jQuery(document).ready(initialize_{{ form.vars.id }}('ul_' + '{{ form.vars.id }}
|
|||||||
|
|
||||||
{% block choice_with_other_widget %}
|
{% block choice_with_other_widget %}
|
||||||
<div {{ block('widget_container_attributes') }}>
|
<div {{ block('widget_container_attributes') }}>
|
||||||
|
|
||||||
{%- for child in form.children._choices %}
|
{%- for child in form.children._choices %}
|
||||||
{%- if child.vars.value == '_other' -%}
|
|
||||||
{{- form_widget(child) -}} {{- form_widget(form.children._other) -}}
|
|
||||||
{%- else -%}
|
|
||||||
{{- form_widget(child) -}}
|
{{- form_widget(child) -}}
|
||||||
{{- form_label(child) -}}
|
{{- form_label(child) -}}
|
||||||
|
{%- if child.vars.value == '_other' -%}
|
||||||
|
{{- form_widget(form.children._other) -}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user