mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
/**
 | 
						|
 * Chill is a software for social workers
 | 
						|
 *
 | 
						|
 * For the full copyright and license information, please view
 | 
						|
 * the LICENSE file that was distributed with this source code.
 | 
						|
 */
 | 
						|
 | 
						|
namespace Chill\MainBundle\DependencyInjection;
 | 
						|
 | 
						|
   use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
 | 
						|
   use Symfony\Component\Config\Definition\Builder\TreeBuilder;
 | 
						|
   use Symfony\Component\Config\Definition\ConfigurationInterface;
 | 
						|
   use Symfony\Component\DependencyInjection\ContainerBuilder;
 | 
						|
 | 
						|
   /**
 | 
						|
    * Configure the main bundle.
 | 
						|
    */
 | 
						|
   class Configuration implements ConfigurationInterface
 | 
						|
   {
 | 
						|
       use AddWidgetConfigurationTrait;
 | 
						|
 | 
						|
       /**
 | 
						|
        * @var ContainerBuilder
 | 
						|
        */
 | 
						|
       private $containerBuilder;
 | 
						|
 | 
						|
       public function __construct(
 | 
						|
           array $widgetFactories = [],
 | 
						|
           ContainerBuilder $containerBuilder
 | 
						|
       ) {
 | 
						|
           // we register here widget factories (see below)
 | 
						|
           $this->setWidgetFactories($widgetFactories);
 | 
						|
           // we will need the container builder later...
 | 
						|
           $this->containerBuilder = $containerBuilder;
 | 
						|
       }
 | 
						|
 | 
						|
       public function getConfigTreeBuilder()
 | 
						|
       {
 | 
						|
           $treeBuilder = new TreeBuilder();
 | 
						|
           $rootNode = $treeBuilder->root('chill_main');
 | 
						|
 | 
						|
           $rootNode
 | 
						|
               ->children()
 | 
						|
 | 
						|
                   // ...
 | 
						|
               ->arrayNode('widgets')
 | 
						|
               ->canBeDisabled()
 | 
						|
               ->children()
 | 
						|
                            // we declare here all configuration for homepage place
 | 
						|
               ->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder))
 | 
						|
               ->end() // end of widgets/children
 | 
						|
               ->end() // end of widgets
 | 
						|
               ->end() // end of root/children
 | 
						|
               ->end() // end of root
 | 
						|
;
 | 
						|
 | 
						|
           return $treeBuilder;
 | 
						|
       }
 | 
						|
   }
 |