This repository was archived by the owner on Feb 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 234
/
Copy pathConfiguration.php
59 lines (52 loc) · 1.56 KB
/
Configuration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/*
* This file is part of the SgDatatablesBundle package.
*
* (c) stwe <https://github.com/stwe/DatatablesBundle>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sg\DatatablesBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('sg_datatables');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('sg_datatables');
}
$this->addDatatableSection($rootNode);
return $treeBuilder;
}
/**
* Add datatable section.
*/
private function addDatatableSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->children()
->arrayNode('datatable')->addDefaultsIfNotSet()
->children()
->arrayNode('query')->addDefaultsIfNotSet()
->children()
->booleanNode('translation_query_hints')
->defaultFalse()
->end()
->end()
->end()
->end()
->end()
->end()
;
}
}