src/Form/Type/Frontend/YearSearchType.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type\Frontend;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\TextType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. class YearSearchType extends AbstractType
  7. {
  8.     public function buildForm(FormBuilderInterface $builder, array $options): void
  9.     {
  10.         $idRange sprintf('year_%s'uniqid(''false));
  11.         $builder
  12.             ->add('min'TextType::class, [
  13.                 'attr' => [
  14.                     'class' => 'small range min',
  15.                     'placeholder' => 'frontend.search.form.yearSearch.min',
  16.                     'data-range' => $idRange,
  17.                     'data-field' => 'yearMin',
  18.                 ],
  19.             ])
  20.             ->add('max'TextType::class, [
  21.                 'attr' => [
  22.                     'class' => 'small range max',
  23.                     'placeholder' => 'frontend.search.form.yearSearch.max',
  24.                     'data-range' => $idRange,
  25.                     'data-field' => 'yearMax',
  26.                 ],
  27.             ])
  28.         ;
  29.     }
  30.     public function getBlockPrefix()
  31.     {
  32.         return 'year';
  33.     }
  34. }