src/Form/FreeWordType.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\TextType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Contracts\Translation\TranslatorInterface;
  8. class FreeWordType extends AbstractType
  9. {
  10.     private TranslatorInterface $translator;
  11.     public function __construct(TranslatorInterface $translator) {
  12.         $this->translator $translator;
  13.     }
  14.     public function buildForm(FormBuilderInterface $builder, array $options): void
  15.     {
  16.         $builder
  17.             ->add('word'TextType::class, [
  18.                 "label" => false,
  19.                 "attr" => [
  20.                     "placeholder" => $this->translator->trans('index.search_form.placeholder')
  21.                 ]
  22.             ])
  23.         ;
  24.     }
  25.     public function configureOptions(OptionsResolver $resolver): void
  26.     {
  27.         $resolver->setDefaults([
  28.             // Configure your form options here
  29.         ]);
  30.     }
  31. }