I was a bit annoyed when I did something similar as it was more complicated than I thought it should have been. There may be a better way but this is what worked for me.
{% block form_row %}
{% set choice = false %}
{% if not form.vars.compound %}
{% for prefix in form.vars.block_prefixes %}
{% if prefix == 'choice' %}
{% set choice = true %}
{% endif %}
{% endfor %}
{% endif %}
{% if choice %}
<div class="row">
{{ form_label(form) }}
{{ form_errors(form) }}
{{ form_widget(form) }}
</div>
{% else %}
<div class="row">
{{ form_errors(form) }}
{{ form_label(form) }}
{{ form_widget(form, { 'attr': {'class': 'form-control'} }) }}
</div>
{% endif %}
{% endblock form_row %}
I would recommend using form_row
instead of form_field
to ease any future transition to to 2.3+ as form_field
has been remove from symfony 2.3+ but form_row
works in 2.1.