1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * (c) Christian Gripp <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Core23\Twig\Bridge\Symfony\DependencyInjection; |
||
13 | |||
14 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||
15 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
16 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||
17 | |||
18 | final class Configuration implements ConfigurationInterface |
||
19 | { |
||
20 | public function getConfigTreeBuilder() |
||
21 | { |
||
22 | $treeBuilder = new TreeBuilder('core23_twig'); |
||
23 | |||
24 | $rootNode = $treeBuilder->getRootNode(); |
||
25 | |||
26 | \assert($rootNode instanceof ArrayNodeDefinition); |
||
27 | |||
28 | $this->addPaginationSection($rootNode); |
||
29 | |||
30 | return $treeBuilder; |
||
31 | } |
||
32 | |||
33 | private function addPaginationSection(ArrayNodeDefinition $node): void |
||
34 | { |
||
35 | $node |
||
36 | ->children() |
||
37 | ->arrayNode('pagination') |
||
38 | ->addDefaultsIfNotSet() |
||
39 | ->children() |
||
40 | ->scalarNode('template')->defaultValue('@Core23Twig/Pager/pagination.html.twig')->end() |
||
41 | ->scalarNode('extremeLimit')->defaultValue(3)->end() |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
42 | ->scalarNode('nearbyLimit')->defaultValue(2)->end() |
||
43 | ->end() |
||
44 | ->end() |
||
45 | ->end() |
||
46 | ; |
||
47 | } |
||
48 | } |
||
49 |