mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 22:04:59 +00:00
make familial situations and professionnal situations configurable
This commit is contained in:
@@ -24,7 +24,7 @@ class ChillAMLIFamilyMembersExtension extends Extension implements PrependExtens
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$this->storeLinksConfig($container, $config);
|
||||
$this->storeConfig($container, $config);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services/config.yml');
|
||||
@@ -35,14 +35,19 @@ class ChillAMLIFamilyMembersExtension extends Extension implements PrependExtens
|
||||
$loader->load('services/templating.yml');
|
||||
}
|
||||
|
||||
private function storeLinksConfig(ContainerBuilder $container, array $config)
|
||||
private function storeConfig(ContainerBuilder $container, array $config)
|
||||
{
|
||||
$container->setParameter('chill_family_members.links', $config['links']);
|
||||
$container->setParameter('chill_family_members.professionnal_situations',
|
||||
$config['professionnal_situations']);
|
||||
$container->setParameter('chill_family_members.familial_situations',
|
||||
$config['familial_situations']);
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependAuthorization($container);
|
||||
$this->prependRoutes($container);
|
||||
}
|
||||
|
||||
protected function prependAuthorization(ContainerBuilder $container)
|
||||
@@ -54,5 +59,20 @@ class ChillAMLIFamilyMembersExtension extends Extension implements PrependExtens
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
/* (non-PHPdoc)
|
||||
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
|
||||
*/
|
||||
public function prependRoutes(ContainerBuilder $container)
|
||||
{
|
||||
//add routes for custom bundle
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
'routing' => array(
|
||||
'resources' => array(
|
||||
'@ChillAMLIFamilyMembersBundle/Resources/config/routing.yml'
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,23 +22,67 @@ class Configuration implements ConfigurationInterface
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
// ressources
|
||||
->arrayNode('links')->isRequired()->requiresAtLeastOneElement()
|
||||
->arrayPrototype()
|
||||
->children()
|
||||
->scalarNode('key')->isRequired()->cannotBeEmpty()
|
||||
->info('the key stored in database')
|
||||
->scalarNode('key')->isRequired()->cannotBeEmpty()
|
||||
->info('the key stored in database')
|
||||
->example('grandson')
|
||||
->end()
|
||||
->arrayNode('labels')->isRequired()->requiresAtLeastOneElement()
|
||||
->arrayPrototype()
|
||||
->children()
|
||||
->scalarNode('lang')->isRequired()->cannotBeEmpty()
|
||||
->example('fr')
|
||||
->end()
|
||||
->scalarNode('label')->isRequired()->cannotBeEmpty()
|
||||
->example('Petit-fils')
|
||||
->end()
|
||||
->example('fr')
|
||||
->end()
|
||||
->scalarNode('label')->isRequired()->cannotBeEmpty()
|
||||
->example('Petit-fils')
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('professionnal_situations')->isRequired()
|
||||
->info("the list of professional situations. If empty, the field will not be shown")
|
||||
->arrayPrototype()
|
||||
->children()
|
||||
->scalarNode('key')->isRequired()->cannotBeEmpty()
|
||||
->info('the key stored in database')
|
||||
->example('student')
|
||||
->end()
|
||||
->arrayNode('labels')->isRequired()->requiresAtLeastOneElement()
|
||||
->arrayPrototype()
|
||||
->children()
|
||||
->scalarNode('lang')->isRequired()->cannotBeEmpty()
|
||||
->example('fr')
|
||||
->end()
|
||||
->scalarNode('label')->isRequired()->cannotBeEmpty()
|
||||
->example('Étudiant')
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('familial_situations')->isRequired()
|
||||
->info("the list of familial situations. If empty, the field will not be shown")
|
||||
->arrayPrototype()
|
||||
->children()
|
||||
->scalarNode('key')->isRequired()->cannotBeEmpty()
|
||||
->info('the key stored in database')
|
||||
->example('half_time_keeping')
|
||||
->end()
|
||||
->arrayNode('labels')->isRequired()->requiresAtLeastOneElement()
|
||||
->arrayPrototype()
|
||||
->children()
|
||||
->scalarNode('lang')->isRequired()->cannotBeEmpty()
|
||||
->example('fr')
|
||||
->end()
|
||||
->scalarNode('label')->isRequired()->cannotBeEmpty()
|
||||
->example('En garde alternée')
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
|
Reference in New Issue
Block a user