{% extends 'form_div_layout.html.twig' %} {% from 'MopaBootstrapBundle::flash.html.twig' import flash %} {# legends & labels #} {% block form_legend %} {{ label | trans }} {% endblock form_legend %} {% block generic_label %} {% spaceless %} {% if required %} {% set attr = attr|merge({'class': attr.class|default('') ~ ' required'}) %} {% endif %} {% set attr = attr|merge({'class': attr.class|default('') ~ ' control-label'}) %} {{ label|trans }} {% if required %}*{% endif %} {% if widget_add_btn %} {{ block('field_widget_add_btn') }} {% endif %} {% if help_label %}

{{ help_label|trans }}

{% endif %} {% endspaceless %} {% endblock %} {# renders a field label without span class, if e.g field has it#} {% block field_label_attr_aware_label %} {% spaceless %} {% if label_render %} {% set attr = label_attr|merge({'for': id}) %} {{ block('field_label') }} {% endif %} {% endspaceless %} {% endblock field_label_attr_aware_label %} {# Help #} {% block field_help %} {% if help_inline %}

{{ help_inline|trans|raw }}

{%endif %} {% if help_block %}

{{ help_block|trans|raw }}

{%endif %} {% endblock field_help %} {% block field_widget_add_btn %} {% if widget_add_btn %} {% endif %} {% endblock field_widget_add_btn %} {% block field_widget_remove_btn %} {% if widget_remove_btn %} {% endif %} {% endblock field_widget_remove_btn %} {# Errors #} {% block form_errors %} {% spaceless %} {% if error_delay %} {% for child in form %} {% if loop.index == 1 %} {% if child.set('errors', errors) %}{% endif %} {% endif %} {% endfor %} {% else %} {# prevent deep nesting wrong context copy error #} {% from 'MopaBootstrapBundle::flash.html.twig' import flash %} {% for error in errors %} {{ flash('error', error.messageTemplate|trans(error.messageParameters, 'validators')) }} {% endfor %} {% endif %} {% endspaceless %} {% endblock form_errors %} {% block field_errors %} {% spaceless %} {% if errors|length > 0 %} {% for error in errors %} {{ error.messageTemplate|trans(error.messageParameters, 'validators') }}
{% endfor %}
{% endif %} {% endspaceless %} {% endblock field_errors %} {# used to determine which type of error #} {% block error_type %} {% spaceless %} {% if field_error_type %} {{ field_error_type }} {% elseif form.hasParent() != 0 %} {% set form = form.parent %} {{ block('error_type') }} {% elseif form.hasParent() == 0 %} {{ form.get('error_type') }} {% endif %} {% endspaceless %} {% endblock error_type %} {# Basic form and field blocks #} {% block form_widget %} {% if 'form' in form.get('types') and form.hasParent() == 0 %} {% if render_fieldset %}
{% endif %} {% if show_legend %}{{ block('form_legend') }}{% endif %} {% endif %} {{ block('field_rows_visible') }} {{ form_rest(form) }} {% if 'form' in form.get('types') and form.hasParent() == 0 %} {% if render_fieldset %}
{% endif %} {% endif %} {% endblock form_widget %} {# only display non hidden fields #} {% block field_rows_visible %} {% if form_errors(form) %}
{{ form_errors(form) }}
{% endif %} {% for child in form.children %} {% if 'hidden' not in child.get('types') %} {{ form_row(child) }} {% endif %} {% endfor %} {% endblock field_rows_visible %} {% block field_row %} {% set _isCollectionItem = (form.hasParent()|default(false) and form.getParent().get('prototype') ) %} {% set _isSubform = ('form' in form.get('types')) %} {% set attr = attr|merge({'class': attr.class|default('') ~ (errors|length > 0 ? ' error' : '') }) %} {% if not _isSubform %} {% if widget_control_group and not _isCollectionItem %} {% set oid = id %} {% set id = oid ~ "_control_group" %}
{% set id = oid %} {% endif %} {% endif %} {% if _isSubform and form.hasParent() != 0 %} {% if show_child_legend|default(false) %} {{ block('form_legend') }} {% endif %} {% elseif not _isCollectionItem %} {{ block('field_label_attr_aware_label') }} {% endif %} {% if not _isSubform %} {% if widget_controls and not _isCollectionItem %}
{% endif %} {% endif %} {% if _isCollectionItem %}
{% endif %} {{ widget_prefix|raw }} {{ form_widget(form, {'label': label, 'label_render': label_render, 'widget_remove_btn': widget_remove_btn, 'attr': attr, 'widget_addon': widget_addon, 'widget_type': widget_type, 'help_inline': help_inline, 'help_block': help_block, 'widget_control-group': widget_control_group, 'prototype': form.get('prototype')}) }} {{ widget_suffix|raw }} {% if widget_remove_btn is defined %} {{ block('field_widget_remove_btn') }} {% endif %} {% if not _isSubform %} {{ block('field_message') }} {% endif %} {% if _isCollectionItem %}
{% endif %} {% if not _isSubform %} {% if widget_controls and not _isCollectionItem %}
{% endif %} {% endif %} {% if not _isSubform %} {% if widget_control_group and not _isCollectionItem %}
{% endif %} {% endif %} {% endblock field_row %} {% block field_message %} {{ form_errors(form) }} {{ block('field_help') }} {% endblock field_message %} {# basic form widgets #} {% block field_widget %} {% spaceless %} {% set type = type|default('text') %} {% if widget_addon.text|default(false) or widget_addon.icon|default(false) %}
{% if not widget_addon.append %} {{ block('widget_addon') }} {% endif %} {% endif %} {# add class to style display block #} {% if not widget_remove_btn|default(false) %} {% set attr = attr|merge({'class': attr.class|default('') ~ ' not-removable'}) %} {% endif %} {% if widget_addon.text|default(false) or widget_addon.icon|default(false) %} {% if widget_addon.append %} {{ block('widget_addon') }} {% endif %} {% endif %} {% if widget_addon.text|default(false) or widget_addon.icon|default(false) %}
{% endif %} {% endspaceless %} {% endblock field_widget %} {% block widget_addon %} {# prevent deep nesting wrong context copy error #} {% from 'MopaBootstrapBundle::icons.html.twig' import icon %} {{ (widget_addon.text ? widget_addon.text : icon(widget_addon.icon))|raw }} {% endblock widget_addon %} {% block collection_row %} {% set _isSubform = ('form' in form.get('types')) %} {% set attr = attr|merge({'class': attr.class|default('') ~ (errors|length > 0 ? ' error' : '') }) %} {% if widget_control_group %} {% if prototype is defined %} {% set attr = attr|merge({'data-prototype': form_row(prototype), 'data-collection': 'true' }) %} {% endif %} {% set oid = id %} {% set id = oid ~ "_control_group" %}
{% set id = oid %} {% endif %} {{ block('field_label_attr_aware_label') }} {% if widget_controls %}
{% endif %} {{ form_widget(form) }} {% if widget_controls %}
{% endif %} {% if widget_control_group %}
{% endif %} {% endblock collection_row %} {% block collection_widget %} {% spaceless %} {% for child in form.children %} {% if 'hidden' not in child.get('types') %} {#% debug child.get('attr') %#} {#{ form_row(child) }#} {% endif %} {% endfor %} {% if errors|length > 0 %} {% set attr = attr|merge({'class': attr.class|default('') ~ ' error'}) %} {% endif %} {% set coll_item = "BlUB" %} {{ block('form_widget', coll_item) }} {% endspaceless %} {% endblock collection_widget %} {# more form widgets #} {% block textarea_widget %} {% spaceless %} {% set attr = attr %} {% endspaceless %} {% endblock textarea_widget %} {% block choice_widget %} {% if expanded %}
{% if label_render %} {{ form_label(form, label) }} {% endif %}
{% for child in form %} {% endfor %} {{ block('field_message') }}
{% else %} {% endif %} {% endblock choice_widget %} {# Date and Time widgets #} {% block date_widget %} {% spaceless %} {% if widget == 'single_text' %} {{ block('field_widget') }} {% else %}
{{ form_label(form, label) }}
{% set attr = attr|merge({'class': attr.class|default('')}) %}
{{ date_pattern|replace({ '{{ year }}': form_widget(form.year, {'attr': {'class': attr.widget_class|default('') ~ ' input-mini'}}), '{{ month }}': form_widget(form.month, {'attr': {'class': attr.widget_class|default('') ~ ' input-small'}}), '{{ day }}': form_widget(form.day, {'attr': {'class': attr.widget_class|default('') ~ ' input-mini'}}), })|raw }}
{{ block('help') }}
{% endif %} {% endspaceless %} {% endblock date_widget %} {% block time_widget %} {% spaceless %} {% if widget == 'single_text' %} {{ block('field_widget') }} {% else %}
{{ form_label(form, label) }}
{% set attr = attr|merge({'class': attr.class|default('')}) %}
{{ form_widget(form.hour, { 'attr': { 'class': 'input-mini' } }) }}:{{ form_widget(form.minute, { 'attr': { 'class': 'input-mini' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'class': 'input-mini' } }) }}{% endif %}
{{ block('help') }}
{% endif %} {% endspaceless %} {% endblock time_widget %} {% block datetime_widget %} {% if widget == 'single_text' %} {{ block('field_widget') }} {% else %}
{{ form_label(form, label) }}
{% set attr = attr|merge({'class': attr.class|default('')}) %}
{{ form_errors(form.date) }} {{ form_errors(form.time) }} {{ form_widget(form.date, {'attr': {'class': attr.widget_class|default('')}}) }} {{ form_widget(form.time, {'attr': {'class': attr.widget_class|default('')}}) }}
{{ block('field_help') }}
{% endif %} {% endblock datetime_widget %} {# widget attributes #} {% block widget_attributes %} {% spaceless %} id="{{ id }}" name="{{ full_name }}"{% if read_only %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %} {% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue|trans}}" {% endfor %} {% endspaceless %} {% endblock widget_attributes %}