From 4c90c2db627a46f74ec3618371159377e8c5b485 Mon Sep 17 00:00:00 2001 From: LucileDT Date: Sat, 11 Jul 2020 14:49:32 +0200 Subject: [PATCH] Ref #215: use Select2 in donation creation&edit forms --- src/Form/DonationType.php | 3 +++ templates/Donation/edit.html.twig | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Form/DonationType.php b/src/Form/DonationType.php index d0bfa4c8..98f1d26d 100644 --- a/src/Form/DonationType.php +++ b/src/Form/DonationType.php @@ -33,6 +33,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('donator', EntityType::class, [ // looks for choices from this entity 'class' => People::class, + 'attr' => [ + 'data-toggle' => 'select2' + ], // uses firstname and lastname as the visible option string 'choice_label' => function($people) { return $people->getFirstName() . ' ' . $people->getLastName(); diff --git a/templates/Donation/edit.html.twig b/templates/Donation/edit.html.twig index 4bd3d484..a9026529 100644 --- a/templates/Donation/edit.html.twig +++ b/templates/Donation/edit.html.twig @@ -45,7 +45,7 @@
{% include 'Donation/_people_selector.html.twig' - with {'form_donator_widget' : form_widget(form.donator)} %} + with {'form_donator_widget' : form_widget(form.donator)} %}