src/Form/SearchForm.php line 13
<?php
namespace App\Form;
use App\Data\SearchData;
use App\Entity\Category;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class SearchForm extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('q', TextType::class, [
'label' => false,
'required' => false,
'attr' => [
'placeholder' => 'Rechercher un commerce'
]
])
->add('Category', EntityType::class, [
'label' => false,
'required' => false,
'class' => Category::class,
'expanded' => true,
'multiple' => true
])
->add('verified', CheckboxType::class, [
'label' => 'Vérifié par Best of Sarlat',
'required' => false
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => SearchData::class,
// 'method' => 'GET',
'csrf_protection' => false
]);
}
public function getBlockPrefix()
{
return '';
}
}