[FEATURE] allow adding of user filters in filter order - template still to be done

This commit is contained in:
2023-07-05 10:54:37 +02:00
parent 0e5f1b4ab9
commit 25d4b6acbb
3 changed files with 83 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Form\Type\Listing;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\PickUserDynamicType;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
@@ -120,6 +121,35 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType
$builder->add($singleCheckBoxBuilder);
}
if ([] !== $helper->getUserPickers()) {
$userPickersBuilder = $builder->create('userPicker', null, ['compound' => true]);
foreach ($helper->getUserPickers() as $name => [
'label' => $label, 'options' => $options
]) {
$userPicker = $userPickersBuilder->create($name, null, [
'compound' => true,
'label' => $label,
]);
$userPicker->add(
$name,
PickUserDynamicType::class,
[
'multiple' => true,
'label' => $label,
...$options,
]
);
$userPickersBuilder->add($userPicker);
}
$builder->add($userPickersBuilder);
}
}
public function buildView(FormView $view, FormInterface $form, array $options)