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

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file has been created by developers from BitBag.
  4.  * Feel free to contact us once you face any issues or want to start
  5.  * another great project.
  6.  * You can find more information about us on https://bitbag.io and write us
  7.  * an email on hello@bitbag.io.
  8.  */
  9. declare(strict_types=1);
  10. namespace BitBag\SyliusElasticsearchPlugin\Form\Type;
  11. use BitBag\SyliusElasticsearchPlugin\Model\SearchBox;
  12. use Symfony\Component\Form\AbstractType;
  13. use Symfony\Component\Form\Extension\Core\Type\SearchType as SymfonySearchType;
  14. use Symfony\Component\Form\FormBuilderInterface;
  15. use Symfony\Component\OptionsResolver\OptionsResolver;
  16. use Symfony\Component\Validator\Constraints\NotBlank;
  17. final class SearchBoxType extends AbstractType
  18. {
  19.     public function buildForm(FormBuilderInterface $builder, array $options): void
  20.     {
  21.         $builder
  22.             ->add(
  23.                 'query',
  24.                 SymfonySearchType::class,
  25.                 [
  26.                     'label' => false,
  27.                     'attr' => [
  28.                         'placeholder' => 'bitbag_sylius_elasticsearch_plugin.ui.search_box.query.placeholder',
  29.                         'class' => 'prompt app-quick-add-code-input',
  30.                     ],
  31.                     'constraints' => [new NotBlank()],
  32.                 ]
  33.             )
  34.         ;
  35.     }
  36.     public function configureOptions(OptionsResolver $resolver): void
  37.     {
  38.         $resolver->setDefault('data_class'SearchBox::class);
  39.     }
  40. }