src/Form/SearchType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  5. use Symfony\Component\Form\Extension\Core\Type\TextType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolver;
  8. final class SearchType extends AbstractType
  9. {
  10.     /**
  11.      * @inheritDoc
  12.      */
  13.     public function buildForm(FormBuilderInterface $builder, array $options): void
  14.     {
  15.         $builder
  16.             ->add('search'TextType::class, [
  17.                 'label' => null,
  18.                 'required' => false,
  19.                 'attr' => [
  20.                     'placeholder' => 'company_list.placeholder_city',
  21.                 ],
  22.             ])
  23.             ->add('submit'SubmitType::class, [
  24.                 'label' => 'company_list.search_button',
  25.                 'attr' => [
  26.                     'class' => 'btn-two',
  27.                 ],
  28.             ])
  29.         ;
  30.     }
  31.     /**
  32.      * @inheritDoc
  33.      */
  34.     public function configureOptions(OptionsResolver $resolver): void
  35.     {
  36.         $resolver->setDefaults([
  37.             'csrf_protection' => false,
  38.             'attr' => [
  39.                 'autocomplete' => 'off',
  40.             ]
  41.         ]);
  42.     }
  43. }