| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Setono\SyliusPaginationPlugin\DependencyInjection; |
||
| 6 | |||
| 7 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
| 8 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||
| 9 | |||
| 10 | final class Configuration implements ConfigurationInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * {@inheritdoc} |
||
| 14 | */ |
||
| 15 | public function getConfigTreeBuilder(): TreeBuilder |
||
| 16 | { |
||
| 17 | if (method_exists(TreeBuilder::class, 'getRootNode')) { |
||
| 18 | $treeBuilder = new TreeBuilder('setono_sylius_pagination'); |
||
| 19 | $rootNode = $treeBuilder->getRootNode(); |
||
| 20 | } else { |
||
| 21 | // BC layer for symfony/config 4.1 and older |
||
| 22 | $treeBuilder = new TreeBuilder(); |
||
| 23 | $rootNode = $treeBuilder->root('setono_sylius_pagination'); |
||
| 24 | } |
||
| 25 | |||
| 26 | $rootNode |
||
| 27 | ->addDefaultsIfNotSet() |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 28 | ->fixXmlConfig('event') |
||
| 29 | ->children() |
||
| 30 | ->scalarNode('page_parameter') |
||
| 31 | ->defaultValue('page') |
||
| 32 | ->cannotBeEmpty() |
||
| 33 | ->info('The query parameter indicating af pagination') |
||
| 34 | ->example('page') |
||
| 35 | ->end() |
||
| 36 | ->booleanNode('listen_to_resources')->defaultTrue()->end() |
||
| 37 | ->arrayNode('events') |
||
| 38 | ->scalarPrototype()->end() |
||
| 39 | ->end() |
||
| 40 | ->end() |
||
| 41 | ; |
||
| 42 | |||
| 43 | return $treeBuilder; |
||
| 44 | } |
||
| 45 | } |
||
| 46 |