chamilo/chamilo-lms

View on GitHub
src/CoreBundle/Resources/views/Layout/form-theme.html.twig

Summary

Maintainability
Test Coverage
{# Uses the default Symfony Tailwind style in
vendor/symfony/twig-bridge/Resources/views/Form/tailwind_2_layout.html.twig #}

{% use 'form_div_layout.html.twig' %}

{%- block form_row -%}
    {% if not compound -%}
        {%- set row_attr = row_attr|merge({ class: row_attr.class|default(row_class|default('p-float-label')) }) -%}
    {% endif %}

    {%- set widget_attr = {} -%}
    {%- if help is not empty -%}
        {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
    {%- endif -%}
    <div class="field">
        <div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
            {% if compound -%}
                {{- form_label(form) -}}
                {{- form_widget(form, widget_attr) -}}
            {% else %}
                {{- form_widget(form, widget_attr) -}}
                {{- form_label(form) -}}
            {% endif %}
            {{- form_errors(form) -}}
            {{- form_help(form) -}}
        </div>
    </div>
{%- endblock form_row -%}

{%- block form_widget_simple -%}
    {%- set attr = attr|merge({ class: attr.class|default('p-inputtext p-component p-filled') }) -%}
    {{- parent() -}}
{%- endblock form_widget_simple -%}

{%- block choice_widget_collapsed -%}
    {%- set attr = attr|merge({ class: attr.class|default('p-dropdown p-component p-inputwrapper p-inputwrapper-filled') }) -%}
    {{- parent() -}}
{%- endblock -%}

{%- block checkbox_widget -%}
        <input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
{%- endblock checkbox_widget -%}