From 819a8cc56d78453dc4278edc28a4f223d9bf1153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 30 Nov 2025 14:02:42 +0100 Subject: [PATCH] Fixed category field in part edit page not being correctly rendered --- src/Form/Type/StructuralEntityType.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Form/Type/StructuralEntityType.php b/src/Form/Type/StructuralEntityType.php index 1018eeeb..51eb21a1 100644 --- a/src/Form/Type/StructuralEntityType.php +++ b/src/Form/Type/StructuralEntityType.php @@ -110,8 +110,10 @@ class StructuralEntityType extends AbstractType //If no help text is explicitly set, we use the dto value as help text and show it as html $resolver->setDefault('help', fn(Options $options) => $this->dtoText($options['dto_value'])); $resolver->setDefault('help_html', fn(Options $options) => $options['dto_value'] !== null); + - $resolver->setDefault('attr', function (Options $options) { + //Normalize the attr to merge custom attributes + $resolver->setNormalizer('attr', function (Options $options, $value) { $tmp = [ 'data-controller' => $options['controller'], 'data-allow-add' => $options['allow_add'] ? 'true' : 'false', @@ -121,7 +123,7 @@ class StructuralEntityType extends AbstractType $tmp['data-empty-message'] = $options['empty_message']; } - return $tmp; + return array_merge($tmp, $value); }); }