php - Symfony form theme flat items -
i have nested object collectiontypes , subforms needed database mapping. in frontend want output fields on same html tree. add div
around subforms , collection types. here theme
{% block form_row %} <div class="form-item" {{ block('widget_container_attributes') }}> {{- form_label(form) -}} {{- form_errors(form) -}} {{- form_widget(form) -}} </div> {% endblock %} {%- block form_widget_compound -%} {%- if form.parent empty -%} {{ form_errors(form) }} {%- endif -%} {{- block('form_rows') -}} {{- form_rest(form) -}} {%- endblock form_widget_compound -%}
example object:
- username
- contact (one-to-one)
- firstname
- lastname
- contactaddresses (one-to-many)
- address ( many-to-many )
- street
- number
- zip
as have multiple object in project , want use same form theme all. how can detect if subform
or collectiontype
not render added div in form_row
.
first thought compound parameter looked compound
true when form type choice.
my current solution set getblockprefix
every form type same entity same. not solution i'm happy seems solution.
Comments
Post a Comment