vendor/bitbag/elasticsearch-plugin/src/Form/Type/SearchBoxType.php line 20

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file was created by developers working at BitBag
  4.  * Do you need more information about us and what we do? Visit our https://bitbag.io website!
  5.  * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
  6. */
  7. declare(strict_types=1);
  8. namespace BitBag\SyliusElasticsearchPlugin\Form\Type;
  9. use BitBag\SyliusElasticsearchPlugin\Model\SearchBox;
  10. use Symfony\Component\Form\AbstractType;
  11. use Symfony\Component\Form\Extension\Core\Type\SearchType as SymfonySearchType;
  12. use Symfony\Component\Form\FormBuilderInterface;
  13. use Symfony\Component\OptionsResolver\OptionsResolver;
  14. use Symfony\Component\Validator\Constraints\NotBlank;
  15. final class SearchBoxType extends AbstractType
  16. {
  17.     public function buildForm(FormBuilderInterface $builder, array $options): void
  18.     {
  19.         $builder
  20.             ->add(
  21.                 'query',
  22.                 SymfonySearchType::class,
  23.                 [
  24.                     'label' => false,
  25.                     'attr' => [
  26.                         'placeholder' => 'bitbag_sylius_elasticsearch_plugin.ui.search_box.query.placeholder',
  27.                         'class' => 'prompt app-quick-add-code-input',
  28.                     ],
  29.                     'constraints' => [new NotBlank()],
  30.                 ]
  31.             )
  32.         ;
  33.     }
  34.     public function configureOptions(OptionsResolver $resolver): void
  35.     {
  36.         $resolver->setDefault('data_class'SearchBox::class);
  37.     }
  38. }