added supervisor setting for user (#4251)

This commit is contained in:
Kevin Papst
2023-08-20 13:18:35 +02:00
committed by GitHub
parent 9baa477bed
commit 3e61e0dce6
28 changed files with 358 additions and 612 deletions

View File

@@ -16,18 +16,18 @@ use Symfony\Component\Form\FormEvents;
trait ColorTrait
{
protected function addColor(FormBuilderInterface $builder): void
protected function addColor(FormBuilderInterface $builder, bool $required = false): void
{
$builder
->add('color', ColorChoiceType::class, [
'required' => false,
'required' => $required,
])
;
// this code exists only for backward compatibility
$builder->addEventListener(
FormEvents::PRE_SET_DATA,
function (FormEvent $event) {
function (FormEvent $event) use ($required) {
if (!$event->getForm()->getConfig()->hasOption('choices')) {
return;
}
@@ -42,7 +42,7 @@ trait ColorTrait
}
$event->getForm()->add('color', ColorChoiceType::class, [
'required' => false,
'required' => $required,
'choices' => $choices,
]);
}