Fix config tree issues
This commit is contained in:
@@ -13,18 +13,6 @@ class Configuration implements ConfigurationInterface
|
|||||||
public function getConfigTreeBuilder(): TreeBuilder
|
public function getConfigTreeBuilder(): TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('pcm_icon');
|
$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());
|
$this->addValidationRules($treeBuilder->getRootNode());
|
||||||
|
|
||||||
return $treeBuilder;
|
return $treeBuilder;
|
||||||
@@ -46,23 +34,25 @@ class Configuration implements ConfigurationInterface
|
|||||||
->end()
|
->end()
|
||||||
->end()
|
->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()
|
->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()
|
|
||||||
// ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user