Fixed category field in part edit page not being correctly rendered

This commit is contained in:
Jan Böhmer 2025-11-30 14:02:42 +01:00
parent 95c5ab7b8b
commit 819a8cc56d

View file

@ -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);
});
}