<?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* 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
*/
declare(strict_types=1);
namespace BitBag\SyliusElasticsearchPlugin\Form\Type;
use BitBag\SyliusElasticsearchPlugin\Model\SearchBox;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SearchType as SymfonySearchType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;
final class SearchBoxType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add(
'query',
SymfonySearchType::class,
[
'label' => false,
'attr' => [
'placeholder' => 'bitbag_sylius_elasticsearch_plugin.ui.search_box.query.placeholder',
'class' => 'prompt app-quick-add-code-input',
],
'constraints' => [new NotBlank()],
]
)
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefault('data_class', SearchBox::class);
}
}