{% extends 'form_div_layout.html.twig' %} {% from 'MopaBootstrapBundle::flash.html.twig' import flash %} {# Widgets #} {% block form_widget_simple %} {% spaceless %} {% set type = type|default('text') %} {% if type != 'hidden' and widget_addon.type|default(null) is not null %}
{% if widget_addon.type == 'prepend' %} {{ block('widget_addon') }} {% endif %} {% endif %} {% if not widget_remove_btn|default(null) %} {% set attr = attr|merge({'class': attr.class|default('') ~ ' not-removable'}) %} {% endif %} {% if type != 'hidden' and widget_addon.type|default(null) is not null %} {% if widget_addon.type == 'append' %} {{ block('widget_addon') }} {% endif %}
{% endif %} {% endspaceless %} {% endblock form_widget_simple %} {% block form_widget_compound %} {% spaceless %} {% if not form.hasParent() %} {% if render_fieldset %}
{% endif %} {% if show_legend %}{{ block('form_legend') }}{% endif %} {% endif %} {{ block('form_rows_visible') }} {{ form_rest(form) }} {% if not form.hasParent() %} {% if render_fieldset %}
{% endif %} {% endif %} {% endspaceless %} {% endblock form_widget_compound %} {% block collection_widget %} {% spaceless %} {{ block('form_widget') }} {% endspaceless %} {% endblock collection_widget %} {% block choice_widget_expanded %} {% spaceless %}
{% for child in form %} {% endfor %} {{ block('form_message') }}
{% endspaceless %} {% endblock choice_widget_expanded %} {% block checkbox_widget %} {% spaceless %} {% if form.hasParent() and 'choice' not in form.parent.vars.types %} {% endif %} {% endspaceless %} {% endblock checkbox_widget %} {% block date_widget %} {% spaceless %} {% if widget == 'single_text' %} {{ block('form_widget_simple') }} {% else %} {% set attr = attr|merge({'class': attr.class|default('inline')}) %} {{ date_pattern|replace({ '{{ year }}': form_widget(form.year, {'attr': {'class': attr.widget_class|default('') ~ ' input-small'}}), '{{ month }}': form_widget(form.month, {'attr': {'class': attr.widget_class|default('') ~ ' input-mini'}}), '{{ 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('form_widget_simple') }} {% else %} {% set attr = attr|merge({'class': attr.class|default('')}) %}
{{ form_widget(form.hour, { 'attr': { 'size': '1', 'class': 'input-mini' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1', 'class': 'input-mini' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1', 'class': 'input-mini' } }) }}{% endif %}
{{ block('help') }} {% endif %} {% endspaceless %} {% endblock time_widget %} {% block datetime_widget %} {% spaceless %} {% if widget == 'single_text' %} {{ block('form_widget_simple') }} {% else %} {% 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('form_help') }} {% endif %} {% endspaceless %} {% endblock datetime_widget %} {% block percent_widget %} {% spaceless %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock percent_widget %} {% block money_widget %} {% spaceless %} {% set widget_addon = widget_addon|merge({'text': money_pattern|replace({ '{{ widget }}': ''})}) %} {{ block('form_widget_simple') }} {% endspaceless %} {% endblock money_widget %} {# Labels #} {% block form_legend %} {% spaceless %} {{ label|trans({}, translation_domain) }} {% endspaceless %} {% endblock form_legend %} {% block form_label %} {% spaceless %} {% if label_render %} {% if label is empty %} {% set label = name|humanize %} {% 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'}) %} {% endif %} {% set label_attr = label_attr|merge({'class': label_attr.class|default('') ~ ' control-label'}) %} {{ label|trans({}, translation_domain) }} {{ block('label_asterisk') }} {% if widget_add_btn %} {{ block('form_widget_add_btn') }} {% endif %} {% if help_label %}

{{ help_label|trans({}, translation_domain) }}

{% endif %} {% endif %} {% endspaceless %} {% endblock form_label %} {# Rows #} {% block form_rows_visible %} {% spaceless %} {% if form_errors(form) %}
{{ form_errors(form) }}
{% endif %} {% for child in form %} {% if 'hidden' not in child.vars.types %} {% if 'collection' in form.vars.types and not ommit_collection_item %}
{% endif %} {{ form_row(child) }} {% if 'collection' in form.vars.types and not ommit_collection_item %}
{% endif %} {% endif %} {% endfor %} {% endspaceless %} {% endblock form_rows_visible %} {% block form_row %} {% spaceless %} {% set attr = attr|merge({'class': attr.class|default('') ~ (errors|length > 0 ? ' error' : '') }) %} {{ block('widget_control_group_start') }} {{ widget_prefix|raw }} {{ form_widget(form, _context) }} {{ widget_suffix|raw }} {% if widget_remove_btn is defined %} {{ block('form_widget_remove_btn') }} {% endif -%} {{ block('form_message') }} {{ block('widget_control_group_end') }} {% endspaceless %} {% endblock form_row %} {# Support #} {% block form_message %} {% spaceless %} {{ form_errors(form) }} {{ block('form_help') }} {% endspaceless %} {% endblock form_message %} {# Help #} {% block form_help %} {% spaceless %} {% if 'checkbox' not in form.vars.types %}{# checkbox widget/choice widget problem see https://github.com/phiamo/MopaBootstrapBundle/commit/67406a16b38e5b622fffdd5b9c8a8707ca73f493#commitcomment-1295951 # #} {% if help_inline %}

{{ help_inline|trans|raw }}

{%endif %} {% endif %} {% if help_block %}

{{ help_block|trans|raw }}

{%endif %} {% endspaceless %} {% endblock form_help %} {% block form_widget_add_btn %} {% spaceless %} {% if widget_add_btn %} {% set button_type = 'add' %} {% set button_values = widget_add_btn %} {{ block('collection_button') }} {% endif %} {% endspaceless %} {% endblock form_widget_add_btn %} {% block form_widget_remove_btn %} {% spaceless %} {% if widget_remove_btn %} {% set button_type = 'remove' %} {% set button_values = widget_remove_btn %} {{ block('collection_button') }} {% endif %} {% endspaceless %} {% endblock form_widget_remove_btn %} {% block collection_button %} {% if button_values.icon is defined %} {% endif %} {{ button_values.label }} {% endblock collection_button %} {% block label_asterisk %} {% if render_required_asterisk %} {% if required %}*{% endif %} {% endif %} {% endblock label_asterisk %} {% block widget_addon %} {% spaceless %} {# 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 }} {% endspaceless %} {% endblock widget_addon %} {# 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 error_type %} {{ error_type }} {% elseif form.hasParent() != 0 %} {% set form = form.parent %} {{ block('error_type') }} {% elseif form.hasParent() == 0 %} {{ form.vars.error_type | default('inline') }} {% endif %} {% endspaceless %} {% endblock error_type %} {# widget helper blocks #} {% block widget_control_group_start %} {% spaceless %} {% if widget_control_group|default(false) or not form.hasParent() %} {% if prototype is defined %} {% set data_prototype = '
' ~ form_row(prototype) ~ '
' %} {% set widget_control_group_attr = widget_control_group_attr|merge({'data-prototype': data_prototype}) %} {% endif %} {% set widget_control_group_attr = widget_control_group_attr|merge({'id': id ~ '_control_group', 'class': widget_control_group_attr.class|default('') ~ ' control-group'}) %} {% if errors|length > 0 %} {% set widget_control_group_attr = widget_control_group_attr|merge({'class': widget_control_group_attr.class|default('') ~ ' error'}) %} {% endif %}
{% if (form.hasChildren() and form.hasParent()) and 'collection' not in form.vars.types %} {% if show_child_legend%} {{ block('form_legend') }} {% endif %} {% else %} {{ form_label(form, label|default(null)) }} {% endif %} {% if widget_controls|default(false) or not form.hasParent() %} {% set widget_controls_attr = widget_controls_attr|merge({'class': widget_controls_attr.class|default('') ~ ' controls'}) %}
{% endif %} {% endif %} {% endspaceless %} {% endblock widget_control_group_start %} {% block widget_control_group_end %} {% spaceless %} {% if widget_control_group|default(false) or not form.hasParent() %} {% if widget_controls|default(false) or not form.hasParent() %}
{% endif %}
{% endif %} {% endspaceless %} {% endblock widget_control_group_end %}