vendor/sonata-project/classification-bundle/src/SonataClassificationBundle.php line 25

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * This file is part of the Sonata Project package.
  5.  *
  6.  * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  7.  *
  8.  * For the full copyright and license information, please view the LICENSE
  9.  * file that was distributed with this source code.
  10.  */
  11. namespace Sonata\ClassificationBundle;
  12. use Sonata\ClassificationBundle\Form\Type\ApiCategoryType;
  13. use Sonata\ClassificationBundle\Form\Type\ApiCollectionType;
  14. use Sonata\ClassificationBundle\Form\Type\ApiContextType;
  15. use Sonata\ClassificationBundle\Form\Type\ApiTagType;
  16. use Sonata\ClassificationBundle\Form\Type\CategorySelectorType;
  17. use Sonata\CoreBundle\Form\FormHelper;
  18. use Symfony\Component\DependencyInjection\ContainerBuilder;
  19. use Symfony\Component\HttpKernel\Bundle\Bundle;
  20. class SonataClassificationBundle extends Bundle
  21. {
  22.     public function build(ContainerBuilder $container)
  23.     {
  24.         $this->registerFormMapping();
  25.     }
  26.     public function boot()
  27.     {
  28.         $this->registerFormMapping();
  29.     }
  30.     /**
  31.      * Register form mapping information.
  32.      *
  33.      * NEXT_MAJOR: remove this method
  34.      */
  35.     public function registerFormMapping()
  36.     {
  37.         if (class_exists(FormHelper::class)) {
  38.             FormHelper::registerFormTypeMapping([
  39.                 'sonata_classification_api_form_category' => ApiCategoryType::class,
  40.                 'sonata_classification_api_form_collection' => ApiCollectionType::class,
  41.                 'sonata_classification_api_form_tag' => ApiTagType::class,
  42.                 'sonata_classification_api_form_context' => ApiContextType::class,
  43.                 'sonata_category_selector' => CategorySelectorType::class,
  44.             ]);
  45.         }
  46.     }
  47. }