diff --git a/src/Form/Service/ParticipantFieldOptionsProvider.php b/src/Form/Service/ParticipantFieldOptionsProvider.php index 9d4a428..e7e311b 100644 --- a/src/Form/Service/ParticipantFieldOptionsProvider.php +++ b/src/Form/Service/ParticipantFieldOptionsProvider.php @@ -442,6 +442,9 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider $this->fieldOptionProviders['bulkInsuranceBooking'] = fn (BookingDto $bookingDto, int $participantIndex, array $options = []) => [ 'label' => 'Für alle Teilnehmer buchen', 'required' => false, + 'attr' => [ + 'data-description' => 'Der hier angezeigte Preis gilt nur für den/die Anmelder:in. Die Preise für die anderen Teilnehmer:innen werden automatisch aktualisiert.', + ], ]; // Insurance field provider - provides age and eligibility filtered insurances for participants diff --git a/templates/forms.html.twig b/templates/forms.html.twig index 1857685..630d7c0 100644 --- a/templates/forms.html.twig +++ b/templates/forms.html.twig @@ -1,5 +1,21 @@ {% use 'form_div_layout.html.twig' %} +{# Macro to render info icon tooltip for descriptions #} +{% macro info_tooltip(description) %} +
+ + +
+{% endmacro %} + {%- block form_row -%} {%- set row_attr = row_attr|merge({ 'class': (row_attr.class|default('') ~ ' mb-1')|trim }) -%} {%- set widget_attr = {} -%} @@ -120,11 +136,13 @@ {%- endblock radio_widget -%} {% block checkbox_row %} + {%- import _self as forms -%} {%- set tooltip = null -%} {%- if form.vars.attr['data-tooltip'] is defined -%} {%- set tooltip = form.vars.attr['data-tooltip'] -%} {%- endif -%} -
+ {%- set description = form.vars.attr['data-description'] ?? null -%} +
+ {%- if description is not null -%} + {{ forms.info_tooltip(description) }} + {%- endif -%} +
+{% endblock %} + +{% block radio_row %} + {%- import _self as forms -%} + {%- set tooltip = null -%} + {%- if form.vars.attr['data-tooltip'] is defined -%} + {%- set tooltip = form.vars.attr['data-tooltip'] -%} + {%- endif -%} + {%- set description = form.vars.attr['data-description'] ?? null -%} +
+ + {%- if description is not null -%} + {{ forms.info_tooltip(description) }} + {%- endif -%}
{% endblock %} @@ -174,28 +218,7 @@ {%- if child.vars.attr['data-tooltip'] is defined -%} {%- set child_attr = child_attr|merge({'data-tooltip': child.vars.attr['data-tooltip']}) -%} {%- endif -%} - - {%- set description = child.vars.attr['data-description'] ?? null -%} - - {%- if description is not null -%} -
- {{- form_row(child, { 'attr': child_attr }) -}} -
- - -
-
- {%- else -%} - {{- form_row(child, { 'attr': child_attr }) -}} - {%- endif -%} + {{- form_row(child, { 'attr': child_attr }) -}} {% endfor -%} {%- endblock choice_widget_expanded -%}