mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
issue649: adapt existing UserCurrentLocationType to use select2 with AdministrativeLocationFilter
This commit is contained in:
@@ -17,6 +17,9 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class UserCurrentLocationType extends AbstractType
|
||||
{
|
||||
@@ -32,6 +35,7 @@ class UserCurrentLocationType extends AbstractType
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
//dump($options);
|
||||
$builder
|
||||
->add('currentLocation', EntityType::class, [
|
||||
'class' => Location::class,
|
||||
@@ -43,7 +47,29 @@ class UserCurrentLocationType extends AbstractType
|
||||
},
|
||||
'placeholder' => 'Pick a location',
|
||||
'required' => false,
|
||||
'label' => $options['label'],
|
||||
'label_attr' => $options['label_attr'],
|
||||
'multiple' => $options['multiple'],
|
||||
'attr' => ['class' => 'select2'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('label', 'Current location')
|
||||
->setDefault('label_attr', [])
|
||||
->setDefault('multiple', false)
|
||||
->setAllowedTypes('multiple', ['bool'])
|
||||
;
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'user_current_location_type';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user