add declaration for customizables classes refs #265

This commit is contained in:
2014-11-04 15:16:38 +01:00
parent 474318e006
commit 475926ca53
6 changed files with 65 additions and 8 deletions

View File

@@ -24,5 +24,12 @@ class ChillCustomFieldsExtension extends Extension
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
//add at least a blank array at 'customizable_entities' options
$customizable_entities = (isset($config['customizables_entities'])
&& count($config['customizables_entities']) > 0)
? $config['customizables_entities'] : array();
$container->setParameter('chill_custom_fields.customizable_entities', $customizable_entities);
}
}

View File

@@ -18,11 +18,22 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('cl_custom_fields');
$rootNode = $treeBuilder->root('chill_custom_fields');
$classInfo = "The class which may receive custom fields";
$nameInfo = "The name which will appears in the user interface. May be translatable";
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
$rootNode
->children()
->arrayNode('customizables_entities')
->prototype('array')
->children()
->scalarNode('class')->isRequired()->info($classInfo)->end()
->scalarNode('name') ->isRequired()->info($nameInfo) ->end()
->end()
->end()
->end()
;
return $treeBuilder;
}