1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sonata package. |
5
|
|
|
* |
6
|
|
|
* (c) Thomas Rabaix <[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 Sonata\NewsBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
15
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* This is the class that validates and merges configuration from your app/config files. |
19
|
|
|
* |
20
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
21
|
|
|
*/ |
22
|
|
|
class Configuration implements ConfigurationInterface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* {@inheritdoc} |
26
|
|
|
*/ |
27
|
|
|
public function getConfigTreeBuilder() |
28
|
|
|
{ |
29
|
|
|
$treeBuilder = new TreeBuilder(); |
30
|
|
|
$rootNode = $treeBuilder->root('sonata_news'); |
31
|
|
|
|
32
|
|
|
$rootNode |
33
|
|
|
->children() |
34
|
|
|
->scalarNode('title')->isRequired()->end() |
35
|
|
|
->scalarNode('link')->isRequired()->end() |
36
|
|
|
->scalarNode('description')->isRequired()->end() |
37
|
|
|
->scalarNode('permalink_generator')->defaultValue('sonata.news.permalink.date')->end() |
38
|
|
|
->scalarNode('salt')->isRequired()->end() |
39
|
|
|
->arrayNode('permalink') |
40
|
|
|
->addDefaultsIfNotSet() |
41
|
|
|
->children() |
42
|
|
|
->scalarNode('date')->defaultValue('%%1$04d/%%2$d/%%3$d/%%4$s')->end() // year/month/day/slug |
43
|
|
|
->end() |
44
|
|
|
->end() |
45
|
|
|
->arrayNode('table') |
46
|
|
|
->addDefaultsIfNotSet() |
47
|
|
|
->children() |
48
|
|
|
->scalarNode('post_tag')->defaultValue('news__post_tag')->end() |
49
|
|
|
->end() |
50
|
|
|
->end() |
51
|
|
|
->arrayNode('class') |
52
|
|
|
->addDefaultsIfNotSet() |
53
|
|
|
->children() |
54
|
|
|
->scalarNode('tag')->defaultValue('Application\\Sonata\\ClassificationBundle\\Entity\\Tag')->end() |
55
|
|
|
->scalarNode('collection')->defaultValue('Application\\Sonata\\ClassificationBundle\\Entity\\Collection')->end() |
56
|
|
|
->scalarNode('post')->defaultValue('Application\\Sonata\\NewsBundle\\Entity\\Post')->end() |
57
|
|
|
->scalarNode('comment')->defaultValue('Application\\Sonata\\NewsBundle\\Entity\\Comment')->end() |
58
|
|
|
->scalarNode('media')->defaultValue('Application\\Sonata\\MediaBundle\\Entity\\Media')->end() |
59
|
|
|
->scalarNode('user')->defaultValue('Application\\Sonata\\UserBundle\\Entity\\User')->end() |
60
|
|
|
->end() |
61
|
|
|
->end() |
62
|
|
|
|
63
|
|
|
->arrayNode('admin') |
64
|
|
|
->addDefaultsIfNotSet() |
65
|
|
|
->children() |
66
|
|
|
->arrayNode('post') |
67
|
|
|
->addDefaultsIfNotSet() |
68
|
|
|
->children() |
69
|
|
|
->scalarNode('class')->cannotBeEmpty()->defaultValue('Sonata\\NewsBundle\\Admin\\PostAdmin')->end() |
70
|
|
|
->scalarNode('controller')->cannotBeEmpty()->defaultValue('SonataAdminBundle:CRUD')->end() |
71
|
|
|
->scalarNode('translation')->cannotBeEmpty()->defaultValue('SonataNewsBundle')->end() |
72
|
|
|
->end() |
73
|
|
|
->end() |
74
|
|
|
->arrayNode('comment') |
75
|
|
|
->addDefaultsIfNotSet() |
76
|
|
|
->children() |
77
|
|
|
->scalarNode('class')->cannotBeEmpty()->defaultValue('Sonata\\NewsBundle\\Admin\\CommentAdmin')->end() |
78
|
|
|
->scalarNode('controller')->cannotBeEmpty()->defaultValue('SonataNewsBundle:CommentAdmin')->end() |
79
|
|
|
->scalarNode('translation')->cannotBeEmpty()->defaultValue('SonataNewsBundle')->end() |
80
|
|
|
->end() |
81
|
|
|
->end() |
82
|
|
|
->end() |
83
|
|
|
->end() |
84
|
|
|
|
85
|
|
|
->arrayNode('comment') |
86
|
|
|
->children() |
87
|
|
|
->arrayNode('notification') |
88
|
|
|
->children() |
89
|
|
|
->arrayNode('emails') |
90
|
|
|
->prototype('scalar')->cannotBeEmpty()->end() |
91
|
|
|
->end() |
92
|
|
|
->scalarNode('from')->cannotBeEmpty()->end() |
93
|
|
|
->scalarNode('template')->cannotBeEmpty()->end() |
94
|
|
|
->end() |
95
|
|
|
->end() |
96
|
|
|
->end() |
97
|
|
|
->end() |
98
|
|
|
->end() |
99
|
|
|
; |
100
|
|
|
|
101
|
|
|
return $treeBuilder; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|