From 44e2d765250d8c0f3f4817774d9922a8263a2cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 22 Oct 2025 10:10:02 +0200 Subject: [PATCH] feat: show placeholders for individual date parts in date of birth field --- src/Form/BookingParticipantType.php | 5 ----- templates/forms.html.twig | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Form/BookingParticipantType.php b/src/Form/BookingParticipantType.php index 3fdc9c1..384453b 100644 --- a/src/Form/BookingParticipantType.php +++ b/src/Form/BookingParticipantType.php @@ -171,11 +171,6 @@ class BookingParticipantType extends AbstractType 'attr' => [ 'class' => 'flex items-center space-x-2', ], - 'placeholder' => [ - 'year' => 'Jahr', - 'month' => 'Monat', - 'day' => 'Tag', - ], ], $getFieldState('dateOfBirth'))) ->add('gender', ChoiceType::class, $this->mergeFieldState([ 'label' => 'Geschlecht', diff --git a/templates/forms.html.twig b/templates/forms.html.twig index bfc7352..5a3849d 100644 --- a/templates/forms.html.twig +++ b/templates/forms.html.twig @@ -194,6 +194,27 @@ {%- endblock multiselect_widget -%} +{%- block birthday_widget -%} + {%- set placeholders = { + 'day': 'Tag', + 'month': 'Monat', + 'year': 'Jahr' + } -%} + {%- set field_order = ['day', 'month', 'year'] -%} +
+ {%- for field_name in field_order -%} + {%- set child = form[field_name] -%} + {%- set child_attr = child.vars.attr|default({}) -%} + {%- set child_attr = child_attr|merge({ + 'placeholder': placeholders[field_name], + 'class': (child_attr.class|default('') ~ ' form-field')|trim + }) -%} + + {{- form_widget(child, {'attr': child_attr}) -}} + {%- endfor -%} +
+{%- endblock birthday_widget -%} + {% block insurance_choice_widget %} {%- if expanded -%} {%- for child in form %}