mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 09:18:24 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			74 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			1.9 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.
 | |
|  */
 | |
| 
 | |
| declare(strict_types=1);
 | |
| 
 | |
| namespace Chill\PersonBundle\Widget;
 | |
| 
 | |
| use Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory;
 | |
| use Symfony\Component\Config\Definition\Builder\NodeBuilder;
 | |
| use Symfony\Component\DependencyInjection\ContainerBuilder;
 | |
| 
 | |
| /**
 | |
|  * add configuration for the person_list widget.
 | |
|  */
 | |
| class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory
 | |
| {
 | |
|     /*
 | |
|      * append the option to the configuration
 | |
|      * see http://symfony.com/doc/current/components/config/definition.html
 | |
|      *
 | |
|      */
 | |
|     public function configureOptions($place, NodeBuilder $node)
 | |
|     {
 | |
|         $node->booleanNode('only_active')
 | |
|             ->defaultTrue()
 | |
|             ->end();
 | |
|         $node->integerNode('number_of_items')
 | |
|             ->defaultValue(50)
 | |
|             ->end();
 | |
|         $node->scalarNode('filtering_class')
 | |
|             ->defaultNull()
 | |
|             ->end();
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * return an array with the allowed places where the widget can be rendered.
 | |
|      *
 | |
|      * @return string[]
 | |
|      */
 | |
|     public function getAllowedPlaces()
 | |
|     {
 | |
|         return ['homepage'];
 | |
|     }
 | |
| 
 | |
|     /*
 | |
|      * return the service id for the service which will render the widget.
 | |
|      *
 | |
|      * this service must implements `Chill\MainBundle\Templating\Widget\WidgetInterface`
 | |
|      *
 | |
|      * the service must exists in the container, and it is not required that the service
 | |
|      * has the `chill_main` tag.
 | |
|      */
 | |
|     public function getServiceId(ContainerBuilder $containerBuilder, $place, $order, array $config)
 | |
|     {
 | |
|         return 'chill_person.widget.person_list';
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * return the widget alias.
 | |
|      *
 | |
|      * @return string
 | |
|      */
 | |
|     public function getWidgetAlias()
 | |
|     {
 | |
|         return 'person_list';
 | |
|     }
 | |
| }
 |