<commit_before>{% extends "ElektraSiteBundle::form.html.twig" %}

{#############################################################################
 # Top level Containers
 #############################################################################}

{% block form_start %}
    <div
            name="{{ form.vars.name }}"
    {% for attrname, attrvalue in attr %}
        {% if attrname == 'css_class' %}
            {% set attrname = 'class' %}
        {% endif %}
        {{ attrname }}="{{ attrvalue }}"
    {% endfor %}
    >
{% endblock form_start %}

{% block form_end %}
    {% if not render_rest is defined or render_rest %}
        {{- form_rest(form) -}}
    {% endif -%}
    </div>
{% endblock form_end %}

{#############################################################################
 # Specific Row Containers
 #############################################################################}

{# checkbox row #}
{% block checkbox_row %}
    {{- block('form_row') -}}
{% endblock checkbox_row %}

{# groups #}
{% block group_row %}
    {% set withBody = true %}
    {% for child in form if child.vars.relation_name is defined %}
        {% set withBody = false %}
    {% endfor %}
    {% set groupsType = form.vars.render_type %}
    {% if groupsType == 'fieldset' %}
        <fieldset>
            <legend>
                {{ label|trans({}, translation_domain) }}
            </legend>
            {% for child in form %}
                {{- form_row(child) -}}
            {% endfor %}
        </fieldset>
    {% elseif groupsType == 'tab' %}
        <div id="form-tab-{{ id }}" class="tab-pane fade{% if first %} active in{% endif %}">
            {% if withBody %}
            <div class="panel-body">
                {% endif %}
                {% for child in form %}
                    {{- form_row(child) -}}
                {% endfor %}
                {% if withBody %}
            </div>
            {% endif %}
        </div>
    {% elseif groupsType == 'panel' %}
        <div class="panel panel-default">
            <div class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#form-panel" href="#form-panel-{{ id }}">{{ label|trans({}, translation_domain) }}</a></h4></div>
            <div id="form-panel-{{ id }}" class="panel-collapse collapse{% if first %} in{% endif %}">
                {% if withBody %}
                <div class="panel-body">
                    {% endif %}
                    {% for child in form %}
                        {{- form_row(child) -}}
                    {% endfor %}
                    {% if withBody %}
                </div>
                {% endif %}
            </div>
        </div>
    {% endif %}
{% endblock group_row %}

{% block relatedList_row %}
    {% if form.vars.relation_name is defined %}
        {#{% set groupsType = form.vars.render_type %}#}

        {{ form_widget(form) }}
    {% else %}
        {{ block('form_row') }}
    {% endif %}
    {#{% set innerClass = 'none' %}#}
    {#{{- block('form_row') -}}#}
{% endblock relatedList_row %}

{#############################################################################
 # Labels
 #############################################################################}

{# generic label #}
{% block form_label %}
    {% if label is not sameas(false) %}
        {% 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 %}
        <span class="col-md-2 control-label"{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
        {{ label|trans({}, translation_domain) }}
        </span>
    {% endif %}
{% endblock form_label %}

{# checkbox label #}
{% block checkbox_label %}
    {{ block('form_label') }}
{% endblock checkbox_label %}

{#############################################################################
 # Widgets - core types
 #############################################################################}

{# simple input widget #}
{% block form_widget_simple -%}
    {% set type = type|default('text') -%}
    <span class="form-control" {{ block('widget_attributes') }}>
        {% if value is not empty %}{{ value }}{% endif %}
    </span>
{%- endblock form_widget_simple %}

{# hidden -> not displaying in view theme #}
{% block hidden_widget %}
{% endblock hidden_widget %}

{# textarea widget #}
{% block textarea_widget -%}
    <div class="form-control" {{ block('widget_attributes') }}>{{ value }}</div>
{%- endblock textarea_widget %}

{# checkbox widget #}
{% block checkbox_widget -%}
    <span class="form-control">
        {% if checked %}Yes{% else %}No{% endif %}
    </span>
{%- endblock checkbox_widget %}

{# choice widget (collapsed form) #}
{% block choice_widget_collapsed -%}
    {% for group_label, choice in choices %}
        {% if choice is iterable %}
            {% set options = choice %}
            {{- block('choice_widget_options') -}}
        {% else %}
            {% if choice is selectedchoice(value) %}
                <span class="form-control">
                {{ choice.label|trans({}, translation_domain) }}
            </span>
            {% endif %}
        {% endif %}
    {% endfor %}
{%- endblock choice_widget_collapsed %}

{#############################################################################
 # Widgets - custom types<commit_msg>Fixed display bug for form view<commit_after>{% extends "ElektraSiteBundle::form.html.twig" %}

{#############################################################################
 # Top level Containers
 #############################################################################}

{% block form_start %}
    <div
            name="{{ form.vars.name }}"
    {% for attrname, attrvalue in attr %}
        {% if attrname == 'css_class' %}
            {% set attrname = 'class' %}
        {% endif %}
        {{ attrname }}="{{ attrvalue }}"
    {% endfor %}
    >
{% endblock form_start %}

{% block form_end %}
    {% if not render_rest is defined or render_rest %}
        {{- form_rest(form) -}}
    {% endif -%}
    </div>
{% endblock form_end %}

{#############################################################################
 # Specific Row Containers
 #############################################################################}

{# checkbox row #}
{% block checkbox_row %}
    {{- block('form_row') -}}
{% endblock checkbox_row %}

{# groups #}
{% block group_row %}
    {% set withBody = true %}
    {% for child in form if child.vars.relation_name is defined %}
        {% set withBody = false %}
    {% endfor %}
    {% set groupsType = form.vars.render_type %}
    {% if groupsType == 'fieldset' %}
        <fieldset>
            <legend>
                {{ label|trans({}, translation_domain) }}
            </legend>
            {% for child in form %}
                {{- form_row(child) -}}
            {% endfor %}
        </fieldset>
    {% elseif groupsType == 'tab' %}
        <div id="form-tab-{{ id }}" class="tab-pane fade{% if first %} active in{% endif %}">
            {% if withBody %}
            <div class="panel-body">
                {% endif %}
                {% for child in form %}
                    {{- form_row(child) -}}
                {% endfor %}
                {% if withBody %}
            </div>
            {% endif %}
        </div>
    {% elseif groupsType == 'panel' %}
        <div class="panel panel-default">
            <div class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#form-panel" href="#form-panel-{{ id }}">{{ label|trans({}, translation_domain) }}</a></h4></div>
            <div id="form-panel-{{ id }}" class="panel-collapse collapse{% if first %} in{% endif %}">
                {% if withBody %}
                <div class="panel-body">
                    {% endif %}
                    {% for child in form %}
                        {{- form_row(child) -}}
                    {% endfor %}
                    {% if withBody %}
                </div>
                {% endif %}
            </div>
        </div>
    {% endif %}
{% endblock group_row %}

{% block relatedList_row %}
    {% if form.vars.relation_name is defined %}
        {#{% set groupsType = form.vars.render_type %}#}

        {{ form_widget(form) }}
    {% else %}
        {{ block('form_row') }}
    {% endif %}
    {#{% set innerClass = 'none' %}#}
    {#{{- block('form_row') -}}#}
{% endblock relatedList_row %}

{#############################################################################
 # Labels
 #############################################################################}

{# generic label #}
{% block form_label %}
    {% if label is not sameas(false) %}
        {% 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 %}
        <span class="col-md-2 control-label"{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
        {{ label|trans({}, translation_domain) }}
        </span>
    {% endif %}
{% endblock form_label %}

{# checkbox label #}
{% block checkbox_label %}
    {{ block('form_label') }}
{% endblock checkbox_label %}

{#############################################################################
 # Widgets - core types
 #############################################################################}

{# simple input widget #}
{% block form_widget_simple -%}
    {% set type = type|default('text') -%}
    <span class="form-control" {{ block('widget_attributes') }}>
        {% if value is not empty %}{{ value }}{% endif %}
    </span>
{%- endblock form_widget_simple %}

{# hidden -> not displaying in view theme #}
{% block hidden_widget %}
{% endblock hidden_widget %}

{# textarea widget #}
{% block textarea_widget -%}
    <div class="form-control" {{ block('widget_attributes') }}>{{ value }}</div>
{%- endblock textarea_widget %}

{# checkbox widget #}
{% block checkbox_widget -%}
    <span class="form-control">
        {% if checked %}Yes{% else %}No{% endif %}
    </span>
{%- endblock checkbox_widget %}

{# choice widget (collapsed form) #}
{% block choice_widget_collapsed -%}
    {% for group_label, choice in choices %}
        {% if choice is iterable %}
            {% for label, groupedChoice in choice %}
                {% if groupedChoice is selectedchoice(value) %}
                    <span class="form-control">
                        {{ groupedChoice.label|trans({}, translation_domain) }}
                    </span>
                {% endif %}
            {% endfor %}
        {% else %}
            {% if choice is selectedchoice(value) %}
                <span class="form-control">
                {{ choice.label|trans({}, translation_domain) }}
            </span>
            {% endif %}
        {% endif %}
    {% endfor %}
{%- endblock choice_widget_collapsed %}

{#############################################################################
 # Widgets - custom types
{'fraction_non_alphanumeric': 0.27629513343799056, 'fraction_numerical': 0.0005232862375719519, 'mean_word_length': 2.400652431791222, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6884432', 'n_tokens_mistral': 3493, 'n_tokens_neox': 2997, 'n_words': 688}