2025-07-18 11:25:13 +02:00
|
|
|
{% use 'form_div_layout.html.twig' %}
|
|
|
|
|
|
|
|
|
|
{# ---------- FORM START / END ---------- #}
|
|
|
|
|
{% block form_start -%}
|
|
|
|
|
{{ parent() }}
|
|
|
|
|
{%- endblock %}
|
|
|
|
|
{% block form_end -%}
|
|
|
|
|
{{ parent() }}
|
|
|
|
|
{%- endblock %}
|
|
|
|
|
|
|
|
|
|
{# ---------- ROW ---------- #}
|
2025-12-26 22:13:35 +01:00
|
|
|
{# ---------- ROW : Version Esport / Neubrutaliste ---------- #}
|
2025-07-18 11:25:13 +02:00
|
|
|
{% block form_row %}
|
2025-12-26 22:13:35 +01:00
|
|
|
<div class="flex flex-col mb-6 last:mb-0 w-full">
|
|
|
|
|
{# Label avec style forcé #}
|
|
|
|
|
{{ form_label(form, null, {
|
|
|
|
|
'label_attr': {'class': 'font-black uppercase italic text-xs tracking-widest text-gray-900 mb-2'}
|
|
|
|
|
}) }}
|
|
|
|
|
|
|
|
|
|
{# Widget (Input, Select, etc.) #}
|
|
|
|
|
<div class="relative w-full">
|
2025-07-18 11:25:13 +02:00
|
|
|
{{ form_widget(form) }}
|
|
|
|
|
</div>
|
2025-12-26 22:13:35 +01:00
|
|
|
|
|
|
|
|
{# Erreurs de validation #}
|
|
|
|
|
{% if not form.vars.valid %}
|
|
|
|
|
<div class="mt-2 self-start bg-red-500 text-white font-black italic uppercase text-[10px] px-2 py-1 border-2 border-black shadow-[3px_3px_0px_#000]">
|
|
|
|
|
{{ form_errors(form) }}
|
|
|
|
|
</div>
|
2025-07-18 11:25:13 +02:00
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
|
|
|
|
{% endblock %}
|
|
|
|
|
{# ---------- LABEL ---------- #}
|
|
|
|
|
{% block form_label %}
|
2025-11-16 22:11:48 +01:00
|
|
|
|
2025-07-18 11:25:13 +02:00
|
|
|
{% if label is not same as(false) %}
|
2025-11-16 20:36:51 +01:00
|
|
|
<label for="{{ id }}" class="block text-sm font-medium text-gray-700">
|
2025-07-18 11:25:13 +02:00
|
|
|
{{ label|trans({}, translation_domain) }}
|
|
|
|
|
{% if required %}
|
2025-11-16 20:36:51 +01:00
|
|
|
<span class="text-red-500">*</span>
|
2025-07-18 11:25:13 +02:00
|
|
|
{% endif %}
|
|
|
|
|
</label>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{# ---------- ERRORS ---------- #}
|
|
|
|
|
{% block form_errors %}
|
|
|
|
|
{% if errors|length > 0 %}
|
2025-11-16 20:36:51 +01:00
|
|
|
<ul class="mt-1 text-sm text-red-600 list-disc list-inside">
|
2025-07-18 11:25:13 +02:00
|
|
|
{% for error in errors %}
|
|
|
|
|
<li>{{ error.message }}</li>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</ul>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{# ---------- WIDGET DISPATCH ---------- #}
|
|
|
|
|
{% block form_widget %}
|
|
|
|
|
{% if compound %}
|
|
|
|
|
{{ block('form_widget_compound') }}
|
|
|
|
|
{% else %}
|
|
|
|
|
{{ block('form_widget_simple') }}
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
2025-11-16 20:36:51 +01:00
|
|
|
{# --- STYLE COMMUN POUR WIDGETS (Light Mode) --- #}
|
|
|
|
|
|
2025-07-18 11:25:13 +02:00
|
|
|
{# ---------- SIMPLE INPUTS (text, email, number...) ---------- #}
|
|
|
|
|
{% block form_widget_simple %}
|
|
|
|
|
{% set type = type|default('text') %}
|
|
|
|
|
<input
|
|
|
|
|
type="{{ type }}"
|
|
|
|
|
{{ block('widget_attributes') }}
|
|
|
|
|
value="{{ value }}"
|
2025-11-16 20:36:51 +01:00
|
|
|
class="form-input mt-1 block w-full px-3 py-2 bg-white border border-gray-300 text-gray-900 placeholder-gray-400 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm transition duration-150"
|
2025-07-18 11:25:13 +02:00
|
|
|
/>
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{# ---------- TEXTAREA ---------- #}
|
|
|
|
|
{% block textarea_widget %}
|
|
|
|
|
<textarea
|
|
|
|
|
{{ block('widget_attributes') }}
|
2025-11-16 20:36:51 +01:00
|
|
|
class="form-textarea form-input mt-1 block w-full px-3 py-2 bg-white border border-gray-300 text-gray-900 placeholder-gray-400 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm transition duration-150"
|
2025-07-18 11:25:13 +02:00
|
|
|
>{{ value }}</textarea>
|
|
|
|
|
{% endblock %}
|
2025-12-26 22:13:35 +01:00
|
|
|
{# ---------- CHECKBOX : Alignée en ligne ---------- #}
|
|
|
|
|
{% block checkbox_widget %}
|
|
|
|
|
<label class="flex items-center group cursor-pointer select-none w-full">
|
|
|
|
|
<input type="checkbox" value="{{ value }}" {{ block('widget_attributes') }} {% if checked %}checked="checked"{% endif %} class="peer hidden">
|
2025-07-18 11:25:13 +02:00
|
|
|
|
2025-12-26 22:13:35 +01:00
|
|
|
{# Le carré de la checkbox #}
|
|
|
|
|
<div class="flex-shrink-0 w-6 h-6 bg-white border-[3px] border-black shadow-[3px_3px_0px_#000] peer-checked:bg-green-400 peer-checked:shadow-none peer-checked:translate-x-[2px] peer-checked:translate-y-[2px] transition-all flex items-center justify-center">
|
|
|
|
|
<svg class="w-4 h-4 text-black opacity-0 peer-checked:opacity-100 transition-opacity" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M5 13l4 4L19 7"></path>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{# Le texte à côté #}
|
|
|
|
|
{% if label is defined and label is not same as(false) %}
|
|
|
|
|
<span class="ml-3 font-black uppercase italic text-xs tracking-tight text-gray-900 leading-none">
|
|
|
|
|
{{ label|trans }}
|
|
|
|
|
</span>
|
2025-07-18 11:25:13 +02:00
|
|
|
{% endif %}
|
2025-12-26 22:13:35 +01:00
|
|
|
</label>
|
2025-07-18 11:25:13 +02:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{# ---------- RADIO ---------- #}
|
|
|
|
|
{% block radio_widget %}
|
|
|
|
|
<input type="radio"
|
|
|
|
|
{{ block('widget_attributes') }}
|
|
|
|
|
value="{{ value }}"
|
|
|
|
|
{% if checked %}checked="checked"{% endif %}
|
2025-11-16 20:36:51 +01:00
|
|
|
class="form-radio h-5 w-5 text-indigo-600 border-gray-300 focus:ring-indigo-500">
|
2025-07-18 11:25:13 +02:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{# ---------- FILE ---------- #}
|
|
|
|
|
{% block file_widget %}
|
|
|
|
|
<input type="file"
|
|
|
|
|
{{ block('widget_attributes') }}
|
2025-11-16 20:36:51 +01:00
|
|
|
class="block w-full text-sm text-gray-800 file:mr-4 file:py-2 file:px-4
|
2025-07-18 11:25:13 +02:00
|
|
|
file:rounded-md file:border-0
|
|
|
|
|
file:text-sm file:font-semibold
|
|
|
|
|
file:bg-indigo-600 file:text-white
|
|
|
|
|
hover:file:bg-indigo-700
|
2025-11-16 20:36:51 +01:00
|
|
|
bg-white border border-gray-300 rounded-md shadow-sm">
|
2025-07-18 11:25:13 +02:00
|
|
|
{% endblock %}
|
2025-12-26 22:13:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% block choice_widget_expanded %}
|
|
|
|
|
<div {{ block('widget_container_attributes') }} class="flex flex-col gap-3 mt-2">
|
|
|
|
|
{% for child in form %}
|
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
{{ form_widget(child) }}
|
|
|
|
|
</div>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</div>
|
|
|
|
|
{% endblock %}
|