src/Form/Type/Admin/FontAutoCompleteChoiceType.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 App\Form\Type\Admin;
  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 FontAutoCompleteChoiceType extends AbstractType
  18. {
  19.     /**
  20.      * {@inheritdoc}
  21.      */
  22.     public function configureOptions(OptionsResolver $resolver): void
  23.     {
  24.         $resolver->setDefaults([
  25.             'resource' => 'app.font',
  26.             'choice_name' => 'name',
  27.             'choice_value' => 'id',
  28.         ]);
  29.     }
  30.     /**
  31.      * {@inheritdoc}
  32.      */
  33.     public function buildView(FormView $viewFormInterface $form, array $options): void
  34.     {
  35.         $view->vars['remote_criteria_type'] = 'contains';
  36.         $view->vars['remote_criteria_name'] = 'phrase';
  37.     }
  38.     /**
  39.      * {@inheritdoc}
  40.      */
  41.     public function getBlockPrefix(): string
  42.     {
  43.         return 'app_configurator_font_autocomplete_choice';
  44.     }
  45.     /**
  46.      * {@inheritdoc}
  47.      */
  48.     public function getParent(): string
  49.     {
  50.         return ResourceAutocompleteChoiceType::class;
  51.     }
  52. }