I have problem. I want to do choices country with flag ico but I don't know how to create custom theme for form choice filed.
I created test form :
->add('name', 'choice', array('choices' =>array('en' => 'England', 'de' => 'Deutshland')))
Next in my view I try
{% block _send_name_widget %}
<select>
{% for f in form %}
{{ loop.index }}
{%endfor%}
</select>
{% endblock%}
{{ form_widget(form.name) }}
And in my html code I've got:
<select>
1
2
</select>
<select>
</select>
Could you tell me why?
How can I render only one select with parameters?
Best Solution
The variable "options" didn't exist in my choice_widget_options template. The fact is that "options" IS NOT the correct name of the variable. If you take a look at
\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Resources\views\Form\choice_widget_options.html.php
, you'll find Symfony use a variable called 'choices'.The corrected version of the previous code is :