vendor/sylius/sylius/src/Sylius/Bundle/TaxonomyBundle/Form/Type/TaxonType.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\EventSubscriber\AddCodeFormSubscriber;
  13. use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
  14. use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType;
  15. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  16. use Symfony\Component\Form\FormBuilderInterface;
  17. final class TaxonType extends AbstractResourceType
  18. {
  19.     public function buildForm(FormBuilderInterface $builder, array $options): void
  20.     {
  21.         $builder
  22.             ->add('translations'ResourceTranslationsType::class, [
  23.                 'entry_type' => TaxonTranslationType::class,
  24.                 'label' => 'sylius.form.taxon.name',
  25.             ])
  26.             ->add('enabled'CheckboxType::class, [
  27.                 'required' => false,
  28.                 'label' => 'sylius.form.taxon.enabled',
  29.             ])
  30.             ->addEventSubscriber(new AddCodeFormSubscriber())
  31.             ->add('parent'TaxonAutocompleteChoiceType::class, [
  32.                 'label' => 'sylius.form.taxon.parent',
  33.                 'required' => false,
  34.             ])
  35.         ;
  36.     }
  37.     public function getBlockPrefix(): string
  38.     {
  39.         return 'sylius_taxon';
  40.     }
  41. }