symfony - Symfony2 - MopaBootstrapBundle - how to remove form styling, but still use Collection type -


all want nice collection type add , remove buttons , tried using braincraftedbootstrapbundle, hated, styled forms , if configured not style, wasn't able use collection type functionality provided. decided try mopabootstrapbundle instead, facing similar problem. form styled according bundle , if configure not style:

mopa_bootstrap:     form:         templating: false 

my form unstyled again want it, collection type not working. things not form getting form-horizontal, inputs - form-controls , labels - form-labels classes. ideas missing?

i bundle not style form fields except collection type.

you can overwrite default style of mopabootstrap.

in conf do:

mopa_bootstrap:     form:         templating: yourbundle:form:fields.html.twig 

then in custom fields.html.twig use collection_widget block (https://github.com/phiamo/mopabootstrapbundle/blob/master/resources/views/form/fields.html.twig):

{% block collection_widget %} {% spaceless %} {% if prototype defined %}     {% set prototype_markup = form_row(prototype) %}     {% set data_prototype_name = form.vars.form.vars.prototype.vars.name|default('__name__') %}     {% set data_prototype_label = form.vars.form.vars.prototype.vars.label|default('__name__label__') %}     {% set widget_form_group_attr = widget_form_group_attr|merge({         'data-prototype': prototype_markup,         'data-prototype-name': data_prototype_name,         'data-prototype-label': data_prototype_label     })|merge(attr) %} {% endif %} {# add row default use attr.class change#} {% if 'collection' in form.vars.block_prefixes , attr.class defined %}     {% set widget_form_group_attr = widget_form_group_attr|merge({'class': widget_form_group_attr.class|default('row') ~ ' ' ~ attr.class}) %} {% endif %} {# collection item adds class {form_id}_form-group  #} {% set widget_form_group_attr = widget_form_group_attr|merge({'id': 'collection' ~ id ~ '_form_group', 'class': widget_form_group_attr.class ~ ' collection-items ' ~ id ~ '_form_group'}) %}  <div {% attrname,attrvalue in widget_form_group_attr %} {{attrname}}="{{attrvalue}}"{% endfor %}> {# add initial prototype form #} {% if form.vars.value|length == 0 , prototype defined %}     {% name in prototype_names %}         {{ prototype_markup|replace({'__name__': name})|raw }}     {% endfor %} {% endif %} {{ block('form_widget') }} </div> {% endspaceless %} {% endblock collection_widget %} 

something should trick.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -