feat: link terms in confirmation checkbox label

This commit is contained in:
Björn Fromme
2026-01-06 11:56:03 +01:00
parent 2a13a62291
commit e021fc7570
3 changed files with 15 additions and 1 deletions
+12 -1
View File
@@ -13,8 +13,18 @@ use Symfony\Component\Validator\Constraints as Assert;
class BookingCreateStep4Type extends AbstractType
{
public function __construct(
private readonly string $termsAndConditionsUrl,
) {
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$termsLink = sprintf(
'<a href="%s" target="_blank" rel="noopener" class="underline">AGB</a>',
htmlspecialchars($this->termsAndConditionsUrl, ENT_QUOTES, 'UTF-8')
);
$builder
->add('confirmationAccepted', CheckboxType::class, [
'label' => 'Ich bestätige, dass alle Angaben korrekt sind und möchte verbindlich buchen.',
@@ -26,7 +36,8 @@ class BookingCreateStep4Type extends AbstractType
],
])
->add('termsAccepted', CheckboxType::class, [
'label' => 'Ich bestätige, dass ich die AGB akzeptiere',
'label' => sprintf('Ich bestätige, dass ich die %s akzeptiere', $termsLink),
'label_html' => true,
'mapped' => false,
'constraints' => [
new Assert\IsTrue(