Overriding symfony radio widget
forms, php, symfony, symfony-2.1
Solution
if you're using Radio Field Type, you can customize only the `input` part of the `radio_widget` block by calling `form_widget(form.yourField)`, all it displays is,
{% block radio_widget %}
{% spaceless %}
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
{% endspaceless %}
{% endblock radio_widget %}
But if you're using Choice Field Type to display Radio Fields `(expanded => true and multiple => false)`. You'll then have to override the `choice_widget` block, which call for each child element the `radio_widget` block surrounded by a global `div`
How did you get the "display:none"? because there's no style such this in the default block.
Problem
Default radio widget creates a following structure: ``` <label>...</label> <div id="..."> <div class="clearfix prettyradio labelright blue"> <input type="radio" id="..._0" name="..." value="..." style="display: none;"> <a href="#" class=""></a> ... </div> ``` I found the radio_widget block, but it contains only an input itself. So I can customize there only this part: ``` <input type="radio" id="..._0" name="..." value="1" style="display: none;"> ``` But I can't understand how to change whole the structure of radio choice field? Also, does anybody knows, why symfony adds display:none to the input? Thanks.