123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- {# Widgets #}
- {% block choice_widget %}
- {% spaceless %}
- {% if expanded %}
- <ul {{ block('widget_container_attributes') }} class="inputs-list">
- {% for child in form %}
- <li>
- {% set form_widget_content %}
- {{ form_widget(child) }}
- {% endset %}
- {{ form_label(child, null, { 'in_list_checkbox' : true, 'widget' : form_widget_content } ) }}
- </li>
- {% endfor %}
- </ul>
- {% else %}
- <select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
- {% if empty_value is not none %}
- <option value="">{{ empty_value|trans({}, translation_domain) }}</option>
- {% endif %}
- {% if preferred_choices|length > 0 %}
- {% set options = preferred_choices %}
- {{ block('choice_widget_options') }}
- {% if choices|length > 0 and separator is not none %}
- <option disabled="disabled">{{ separator }}</option>
- {% endif %}
- {% endif %}
- {% set options = choices %}
- {{ block('choice_widget_options') }}
- </select>
- {% endif %}
- {% endspaceless %}
- {% endblock choice_widget %}
- {% block form_widget_simple %}
- {% spaceless %}
- {% set type = type|default('text') %}
- <input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" />
- {% endspaceless %}
- {% endblock form_widget_simple %}
- {# Labels #}
- {% block form_label %}
- {% spaceless %}
- {% if not compound %}
- {% set attr = attr|merge({'for': id}) %}
- {% endif %}
- {% if required %}
- {% set attr = attr|merge({'class': attr.class|default('') ~ ' required'}) %}
- {% endif %}
- {% if in_list_checkbox is defined and in_list_checkbox and widget is defined %}
- <label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>
- {{ widget|raw }}
- <span>
- {{ label|trans({}, translation_domain) }}
- </span>
- </label>
- {% else %}
- <label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>{{ label|trans({}, translation_domain) }}</label>
- {% endif %}
- {% endspaceless %}
- {% endblock %}
- {# Rows #}
- {% block form_row %}
- {% spaceless %}
- <div class="control-group {{ (0 < form_errors(form)|length)? 'error':'' }} ">
- {{ form_label(form, label|default(null)) }}
- <div class="controls">
- {{ form_widget(form) }}
- {{ form_errors(form) }}
- </div>
- </div>
- {% endspaceless %}
- {% endblock form_row %}
- {# Misc #}
- {% block form_errors %}
- {% spaceless %}
- {% if errors|length > 0 %}
- {% if not form.parent or 'repeated' in form.vars['block_prefixes'] %}
- <div class="control-group error">
- {% endif %}
- <span class="help-inline">
- {% for error in errors %}
- {% if loop.first %}
- {{ error.messageTemplate|trans(error.messageParameters, 'validators') }}
- {% endif %}
- {% endfor %}
- </span>
- {% if not form.parent or 'repeated' in form.vars['block_prefixes'] %}
- </div>
- {% endif %}
- {% endif %}
- {% endspaceless %}
- {% endblock form_errors %}
|