Fix config tree issues

This commit is contained in:
Brabli
2023-05-31 11:38:32 +01:00
parent 633e4a284e
commit eec11801b0

View File

@@ -13,18 +13,6 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('pcm_icon');
$treeBuilder->getRootNode()
->children()
->arrayNode('directories')
->scalarPrototype()->end()
->end()
->arrayNode('colours') // Akshewally it is defined
->variablePrototype()->end()
->end()
->end()
;
$this->addValidationRules($treeBuilder->getRootNode());
return $treeBuilder;
@@ -46,23 +34,25 @@ class Configuration implements ConfigurationInterface
->end()
->end()
->end()
->arrayNode('colours')
->validate()
->ifEmpty()
->thenInvalid('Colours cannot be empty!')
->end()
->arrayPrototype()
->normalizeKeys(false)
->children()
->scalarNode('fill')->isRequired()->end()
->scalarNode('stroke')->isRequired()->end()
->scalarNode('fill-hover')->isRequired()->end()
->scalarNode('stroke-hover')->isRequired()->end()
->scalarNode('fill-group-hover')->isRequired()->end()
->scalarNode('stroke-group-hover')->isRequired()->end()
->end()
->end()
->end()
->end()
;
// $rootNode
// ->children()
// ->arrayNode('directories')
// ->scalarPrototype()
// ->validate()
// ->ifTrue(function ($value) {
// // Add validation logic for directories here
// return false;
// })
// ->thenInvalid('Invalid directory')
// ->end()
// ->end()
// ->end()
// ->end()
// ;
}
}