{% use "form_div_layout.html.twig" %} {# Widgets #} {% block form_widget %} {% spaceless %} {% if compound %} {{ block('form_widget_compound') }} {% else %} {{ block('form_widget_simple') }} {% endif %} {% endspaceless %} {% endblock form_widget %} {% block form_widget_simple %} {% spaceless %} {% set style = style|default(bootstrap_get_style()) %} {% set col_size = col_size|default(bootstrap_get_col_size()) %} {% if simple_col is not defined and bootstrap_get_simple_col() %} {% set simple_col = bootstrap_get_simple_col() %} {% endif %} {% if attr.simple_col is defined and attr.simple_col is not empty %} {% set simple_col = attr.simple_col %} {% endif %} {% if attr.col_size is defined and attr.col_size is not empty %} {% set col_size = attr.col_size %} {% endif %} {% if attr.style is defined and attr.style is not empty %} {% set style = attr.style %} {% endif %} {% if simple_col is defined and simple_col %}
{{ value }}
{%- else -%} {% set attr = attr|merge({ 'class': (attr.class|default('') ~ ' form-control')|trim }) %} {%- endif %} {% if simple_col is defined %}{{ value }}
{% endblock %} {# Labels #} {% block form_label %} {% spaceless %} {% set col_size = col_size|default(bootstrap_get_col_size()) %} {% if attr.label_col is defined and attr.label_col is not empty %} {% set label_col = attr.label_col %} {% endif %} {% if attr.widget_col is defined and attr.widget_col is not empty %} {% set widget_col = attr.widget_col %} {% endif %} {% if attr.col_size is defined and attr.col_size is not empty %} {% set col_size = attr.col_size %} {% endif %} {% if label is not sameas(false) %} {% set style = style|default(bootstrap_get_style()) %} {% set label_col = label_col|default(bootstrap_get_label_col()) %} {% if attr.style is defined and attr.style is not empty %} {% set style = attr.style %} {% endif %} {% set label_attr = label_attr|merge({ 'class': (label_attr.class|default('') ~ ' control-label')|trim }) %} {% if style == 'horizontal' %} {% set label_attr = label_attr|merge({ 'class': (label_attr.class|default('') ~ ' col-' ~ col_size ~ '-' ~ label_col)|trim }) %} {% elseif style == 'inline' %} {% set label_attr = label_attr|merge({ 'class': (label_attr.class|default('') ~ ' sr-only')|trim }) %} {% endif %} {% if not compound %} {% set label_attr = label_attr|merge({'for': id}) %} {% endif %} {% if required %} {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} {% endif %} {% if label is empty %} {% set label = name|humanize %} {% endif %} {% endif %} {% endspaceless %} {% endblock form_label %} {% block button_label %}{% endblock %} {# Rows #} {% block repeated_row %} {% spaceless %} {# No need to render the errors here, as all errors are mapped to the first child (see RepeatedTypeValidatorExtension). #} {{ block('form_rows') }} {% endspaceless %} {% endblock repeated_row %} {% block form_row %} {% spaceless %} {% set style = style|default(bootstrap_get_style()) %} {% set col_size = col_size|default(bootstrap_get_col_size()) %} {% if attr.label_col is defined and attr.label_col is not empty %} {% set label_col = attr.label_col %} {% endif %} {% if attr.widget_col is defined and attr.widget_col is not empty %} {% set widget_col = attr.widget_col %} {% if label is sameas(false) and label_col is defined %} {% set widget_col = widget_col + label_col %} {% endif %} {% endif %} {% if attr.col_size is defined and attr.col_size is not empty %} {% set col_size = attr.col_size %} {% endif %} {% if attr.style is defined and attr.style is not empty %} {% set style = attr.style %} {% endif %} {% set label_col = label_col|default(bootstrap_get_label_col()) %} {% set widget_col = widget_col|default(bootstrap_get_widget_col()) %}