vendor/sonata-project/block-bundle/src/SonataBlockBundle.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\BlockBundle;
  12. use Sonata\BlockBundle\DependencyInjection\Compiler\GlobalVariablesCompilerPass;
  13. use Sonata\BlockBundle\DependencyInjection\Compiler\TweakCompilerPass;
  14. use Sonata\CoreBundle\Form\FormHelper;
  15. use Symfony\Component\DependencyInjection\ContainerBuilder;
  16. use Symfony\Component\HttpKernel\Bundle\Bundle;
  17. /**
  18.  * @final since sonata-project/block-bundle 3.0
  19.  */
  20. class SonataBlockBundle extends Bundle
  21. {
  22.     public function build(ContainerBuilder $container)
  23.     {
  24.         $container->addCompilerPass(new TweakCompilerPass());
  25.         $container->addCompilerPass(new GlobalVariablesCompilerPass());
  26.         $this->registerFormMapping();
  27.     }
  28.     public function boot()
  29.     {
  30.         $this->registerFormMapping();
  31.     }
  32.     /**
  33.      * Register form mapping information.
  34.      *
  35.      * NEXT_MAJOR: remove this method
  36.      */
  37.     public function registerFormMapping()
  38.     {
  39.         if (class_exists(FormHelper::class)) {
  40.             FormHelper::registerFormTypeMapping([
  41.                 'sonata_block_service_choice' => 'Sonata\BlockBundle\Form\Type\ServiceListType',
  42.                 'sonata_type_container_template_choice' => 'Sonata\BlockBundle\Form\Type\ContainerTemplateType',
  43.             ]);
  44.         }
  45.     }
  46. }