src/Form/Type/FestivalSearchWithDistanceType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\FormBuilderInterface;
  5. use Symfony\Component\OptionsResolver\OptionsResolver;
  6. use Symfony\Component\Form\Extension\Core\Type\DateType;
  7. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\Extension\Core\Type\HiddenType;
  10. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  11. class FestivalSearchWithDistanceType extends AbstractType
  12. {
  13.     public function buildForm(FormBuilderInterface $builder, array $options)
  14.     {
  15.         $builder
  16.             ->add('location'TextType::class, [
  17.                 'required' => false,
  18.             ])
  19.             ->add('locationhidden'HiddenType::class, [
  20.                 'required' => false,
  21.             ])
  22.             ->add('placeid'HiddenType::class, [
  23.                 'required' => false,
  24.             ])
  25.             ->add('date'DateType::class, [
  26.                 'required' => false,
  27.                 'html5' => false,
  28.                 'widget' => 'single_text',
  29.                 'input' => 'string',
  30.                 'input_format' => 'd/m/Y',
  31.                 'format' => 'dd/MM/yyyy',
  32.             ])
  33.             ->add('distance'ChoiceType::class, [
  34.                 'choices'  => [
  35.                     '50km' => 50000,
  36.                     '100km' => 100000,
  37.                     '200km' => 200000,
  38.                 ],
  39.             ])
  40.             ->add('search'SubmitType::class, [
  41.                     'label' => 'Chercher' ])
  42.         ;
  43.     }
  44.     public function configureOptions(OptionsResolver $resolver)
  45.     {
  46.         $resolver->setDefaults([
  47.             // Configure your form options here
  48.         ]);
  49.     }
  50. }