vendor/sylius/sylius/src/Sylius/Bundle/TaxonomyBundle/Form/Type/TaxonAutocompleteChoiceType.php line 22

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\TaxonomyBundle\Form\Type;
  12. use Sylius\Bundle\ResourceBundle\Form\Type\ResourceAutocompleteChoiceType;
  13. use Symfony\Component\Form\AbstractType;
  14. use Symfony\Component\Form\FormInterface;
  15. use Symfony\Component\Form\FormView;
  16. use Symfony\Component\OptionsResolver\OptionsResolver;
  17. final class TaxonAutocompleteChoiceType extends AbstractType
  18. {
  19.     public function configureOptions(OptionsResolver $resolver): void
  20.     {
  21.         $resolver->setDefaults([
  22.             'resource' => 'sylius.taxon',
  23.             'choice_name' => 'fullname',
  24.             'choice_value' => 'code',
  25.         ]);
  26.     }
  27.     /**
  28.      * @psalm-suppress MissingPropertyType
  29.      */
  30.     public function buildView(FormView $viewFormInterface $form, array $options): void
  31.     {
  32.         $view->vars['remote_criteria_type'] = 'contains';
  33.         $view->vars['remote_criteria_name'] = 'phrase';
  34.     }
  35.     public function getBlockPrefix(): string
  36.     {
  37.         return 'sylius_taxon_autocomplete_choice';
  38.     }
  39.     public function getParent(): string
  40.     {
  41.         return ResourceAutocompleteChoiceType::class;
  42.     }
  43. }