<commit_before>{% extends 'form_div_layout.html.twig' %}

{% use 'VichUploaderBundle:Form:fields.html.twig' %}

{% trans_default_domain 'admin' %}

{%- block button_attributes -%}
    {% set attr = attr | merge({ 'class': (attr.class | default('') ~ ' ' ~ name) | trim }) %}
    {{ parent() }}
{%- endblock button_attributes -%}

{%- block checkbox_widget -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock checkbox_widget -%}

{%- block choice_widget_collapsed -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock choice_widget_collapsed -%}

{%- block choice_widget_expanded -%}
    <div {{ block('widget_container_attributes') }}>
        {% for child in form %}
            {{ form_label(child, null, { translation_domain: choice_translation_domain }) }}
            {{ form_widget(child) }}
        {% endfor %}
    </div>
{%- endblock choice_widget_expanded -%}

{%- block collection_widget -%}
    {% set attr = attr | merge({ 'class': (attr.class | default('') ~ ' collection') | trim }) %}
    {% if allow_add %}
        {% set attr = attr | merge({ 'data-allow-add': 1 }) %}
    {% endif %}
    {% if allow_delete %}
        {% set attr = attr | merge({ 'data-allow-delete': 1 }) %}
    {% endif %}
    {{ parent() }}
{%- endblock collection_widget -%}

{%- block darvin_admin_dropzone_widget -%}
    {% if form.vars.data %}
        {% for image in form.vars.data if image.id and image_exists(image) %}

            {% include 'DarvinAdminBundle:Form:image.html.twig' %}

        {% endfor %}
    {% endif %}
    {{ form_widget(form) }}
{%- endblock -%}

{%- block darvin_admin_slug_suffix_widget -%}

    {% set slug      = attribute(form.parent.vars.data, slug_property) %}
    {% set url       = path(route, {(route_param_slug): slug}) %}
    {% set url_parts = url|split(slug) %}
    {% set widget    = form_widget(form, {'attr': {'data-default': data}}) %}

    <div class="slug_suffix">
        <div class="link_widget"{% if errors is not empty %} style="display: none;"{% endif %}>
            <a href="{{ url }}" target="_blank">{{ url }}</a>
            <button class="edit" type="button">{% trans %}slug_suffix.edit{% endtrans %}</button>

            {% block reset_button %}
                <button class="reset" type="button" style="display: none;">
                    {% trans %}slug_suffix.reset{% endtrans %}
                </button>
            {% endblock %}

        </div>
        <div class="form_widget"{% if errors is empty %} style="display: none;"{% endif %}>
            <span class="url_prefix">{{ url_parts[0] ~ (slug ~ '$')|replace({(data ~ '$'): ''}) }}</span>
            {{ widget|raw }}
            <span class="url_suffix">{{ url_parts[1] }}</span>
            <button class="update" type="button">{% trans %}slug_suffix.update{% endtrans %}</button>

            {{ block('reset_button') }}

        </div>
    </div>
{%- endblock -%}

{%- block darvin_image_image_widget -%}
    {% if form.vars.data and image_exists(form.vars.data) %}

        {% include 'DarvinAdminBundle:Form:image.html.twig' with {
            'image': form.vars.data,
        } %}

    {% endif %}
    {{ form_widget(form) }}
{%- endblock -%}

{%- block form_label -%}
    {% if label is not same as(false) -%}
        {% set label_attr = label_attr | merge({ 'class': (label_attr.class | default('') ~ ' name') | trim }) %}
    {% endif %}
    {{ parent() }}
{%- endblock form_label -%}

{%- block form_row -%}
    <div class="table_row{% if form.children is empty %} childless{% endif %}">
        {{ form_label(form) }}
        {{ form_errors(form) }}
        {{ form_widget(form) }}
    </div>
{%- endblock form_row -%}

{%- block form_widget -%}
    {{ parent() }}
    {% if darvin_admin_info %}
        <div class="description">{{ darvin_admin_info | trans({}, translation_domain) }}</div>
    {% endif %}
{%- endblock form_widget -%}

{%- block form_widget_compound -%}
    <div class="compound">
        {{ parent() }}
    </div>
{%- endblock form_widget_compound -%}

{%- block form_widget_simple -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock form_widget_simple -%}

{%- block radio_widget -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock radio_widget -%}

{%- block textarea_widget -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock textarea_widget -%}

{%- block vich_image_widget -%}
    {% spaceless %}
        <div {{ block('widget_container_attributes') }}>
            {{ form_row(form.file) }}
            {% if form.delete is defined %}
                {{ form_row(form.delete) }}
            {% endif %}

            {% if download_uri is defined and download_uri %}
                <a class="fancybox" href="{{ download_uri }}"><img src="{{ download_uri | admin_image_crop }}" alt="" /></a>
            {% endif %}
        </div>
    {% endspaceless %}
{%- endblock -%}

{%- block widget_attributes -%}
    {% set attr = attr | merge({ 'class': (attr.class | default('') ~ ' ' ~ form.vars.block_prefixes[1]) | trim }) %}
    {{ parent() }}
{%- endblock widget_attributes -%}
<commit_msg>Fix slug suffix form widget no script mode.<commit_after>{% extends 'form_div_layout.html.twig' %}

{% use 'VichUploaderBundle:Form:fields.html.twig' %}

{% trans_default_domain 'admin' %}

{%- block button_attributes -%}
    {% set attr = attr | merge({ 'class': (attr.class | default('') ~ ' ' ~ name) | trim }) %}
    {{ parent() }}
{%- endblock button_attributes -%}

{%- block checkbox_widget -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock checkbox_widget -%}

{%- block choice_widget_collapsed -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock choice_widget_collapsed -%}

{%- block choice_widget_expanded -%}
    <div {{ block('widget_container_attributes') }}>
        {% for child in form %}
            {{ form_label(child, null, { translation_domain: choice_translation_domain }) }}
            {{ form_widget(child) }}
        {% endfor %}
    </div>
{%- endblock choice_widget_expanded -%}

{%- block collection_widget -%}
    {% set attr = attr | merge({ 'class': (attr.class | default('') ~ ' collection') | trim }) %}
    {% if allow_add %}
        {% set attr = attr | merge({ 'data-allow-add': 1 }) %}
    {% endif %}
    {% if allow_delete %}
        {% set attr = attr | merge({ 'data-allow-delete': 1 }) %}
    {% endif %}
    {{ parent() }}
{%- endblock collection_widget -%}

{%- block darvin_admin_dropzone_widget -%}
    {% if form.vars.data %}
        {% for image in form.vars.data if image.id and image_exists(image) %}

            {% include 'DarvinAdminBundle:Form:image.html.twig' %}

        {% endfor %}
    {% endif %}
    {{ form_widget(form) }}
{%- endblock -%}

{%- block darvin_admin_slug_suffix_widget -%}

    {% set slug      = attribute(form.parent.vars.data, slug_property) %}
    {% set url       = path(route, {(route_param_slug): slug}) %}
    {% set url_parts = url|split(slug) %}

    <div class="slug_suffix">
        <div class="link_widget" id="{{ id }}_link_widget">
            <a href="{{ url }}" target="_blank">{{ url }}</a>
            <button class="edit" id="{{ id }}_edit" type="button" style="display: none;">
                {% trans %}slug_suffix.edit{% endtrans %}
            </button>

            {% block reset_button %}
                <button class="reset" type="button" style="display: none;">
                    {% trans %}slug_suffix.reset{% endtrans %}
                </button>
            {% endblock %}

        </div>
        <div class="form_widget" id="{{ id }}_form_widget">
            <span class="url_prefix">{{ url_parts[0] ~ (slug ~ '$')|replace({(data ~ '$'): ''}) }}</span>
            {{ form_widget(form, {'attr': {'data-default': data}})|raw }}
            <span class="url_suffix">{{ url_parts[1] }}</span>
            <button class="update" id="{{ id }}_update" type="button" style="display: none;">
                {% trans %}slug_suffix.update{% endtrans %}
            </button>

            {{ block('reset_button') }}

        </div>
    </div>
    <script>
        document.getElementById('{{ id ~ (errors is empty ? '_form_widget' : '_link_widget') }}').style.display = 'none';
        document.getElementById('{{ id }}_edit').style.display = 'inline';
        document.getElementById('{{ id }}_update').style.display = 'inline';
    </script>
{%- endblock -%}

{%- block darvin_image_image_widget -%}
    {% if form.vars.data and image_exists(form.vars.data) %}

        {% include 'DarvinAdminBundle:Form:image.html.twig' with {
            'image': form.vars.data,
        } %}

    {% endif %}
    {{ form_widget(form) }}
{%- endblock -%}

{%- block form_label -%}
    {% if label is not same as(false) -%}
        {% set label_attr = label_attr | merge({ 'class': (label_attr.class | default('') ~ ' name') | trim }) %}
    {% endif %}
    {{ parent() }}
{%- endblock form_label -%}

{%- block form_row -%}
    <div class="table_row{% if form.children is empty %} childless{% endif %}">
        {{ form_label(form) }}
        {{ form_errors(form) }}
        {{ form_widget(form) }}
    </div>
{%- endblock form_row -%}

{%- block form_widget -%}
    {{ parent() }}
    {% if darvin_admin_info %}
        <div class="description">{{ darvin_admin_info | trans({}, translation_domain) }}</div>
    {% endif %}
{%- endblock form_widget -%}

{%- block form_widget_compound -%}
    <div class="compound">
        {{ parent() }}
    </div>
{%- endblock form_widget_compound -%}

{%- block form_widget_simple -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock form_widget_simple -%}

{%- block radio_widget -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock radio_widget -%}

{%- block textarea_widget -%}
    <div class="input_value">
        {{ parent() }}
    </div>
{%- endblock textarea_widget -%}

{%- block vich_image_widget -%}
    {% spaceless %}
        <div {{ block('widget_container_attributes') }}>
            {{ form_row(form.file) }}
            {% if form.delete is defined %}
                {{ form_row(form.delete) }}
            {% endif %}

            {% if download_uri is defined and download_uri %}
                <a class="fancybox" href="{{ download_uri }}"><img src="{{ download_uri | admin_image_crop }}" alt="" /></a>
            {% endif %}
        </div>
    {% endspaceless %}
{%- endblock -%}

{%- block widget_attributes -%}
    {% set attr = attr | merge({ 'class': (attr.class | default('') ~ ' ' ~ form.vars.block_prefixes[1]) | trim }) %}
    {{ parent() }}
{%- endblock widget_attributes -%}

{'fraction_non_alphanumeric': 0.19614596909327872, 'fraction_numerical': 0.000930925339787749, 'mean_word_length': 2.5572847682119204, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1065355', 'n_tokens_mistral': 3733, 'n_tokens_neox': 3399, 'n_words': 696}