Symfony2 フォームのレンダリングをカスタマイズして、生成されるすべての選択にクラスを追加しようとしています。カスタムの form_div_layout.html.twig があると思いました:
{% block choice_widget_collapsed %}
{% spaceless %}
<select class='myclass' {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
{% if empty_value is not none %}
<option value="">{{ empty_value|trans({}, translation_domain) }}</option>
{% endif %}
{% if preferred_choices|length > 0 %}
{% set options = preferred_choices %}
{{ block('choice_widget_options') }}
{% if choices|length > 0 and separator is not none %}
<option disabled="disabled">{{ separator }}</option>
{% endif %}
{% endif %}
{% set options = choices %}
{{ block('choice_widget_options') }}
</select>
{% endspaceless %}
{% endblock choice_widget_collapsed %}
そしてそれを一緒に使う
{% form_theme form 'YOPYourOwnPoetBundle:Form:form_div_layout.html.twig' %}
トリックを行うでしょう。
ただし、クラス「myclass」は選択に追加されません。私は何を間違っていますか?