<?php
namespace App\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
class FestivalSearchWithDistanceType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('location', TextType::class, [
'required' => false,
])
->add('locationhidden', HiddenType::class, [
'required' => false,
])
->add('placeid', HiddenType::class, [
'required' => false,
])
->add('date', DateType::class, [
'required' => false,
'html5' => false,
'widget' => 'single_text',
'input' => 'string',
'input_format' => 'd/m/Y',
'format' => 'dd/MM/yyyy',
])
->add('distance', ChoiceType::class, [
'choices' => [
'50km' => 50000,
'100km' => 100000,
'200km' => 200000,
],
])
->add('search', SubmitType::class, [
'label' => 'Chercher' ])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
// Configure your form options here
]);
}
}