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.     public function registerFormMapping()
  36.     {
  37.         FormHelper::registerFormTypeMapping([
  38.             'sonata_block_service_choice' => 'Sonata\BlockBundle\Form\Type\ServiceListType',
  39.             'sonata_type_container_template_choice' => 'Sonata\BlockBundle\Form\Type\ContainerTemplateType',
  40.         ]);
  41.     }
  42. }