forked from cystbear/ForumBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfiguration.php
More file actions
148 lines (143 loc) · 7.63 KB
/
Copy pathConfiguration.php
File metadata and controls
148 lines (143 loc) · 7.63 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
namespace Herzult\Bundle\ForumBundle\DependencyInjection;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* Forum configuration
*
* @author Antoine Hérault <antoine.herault@gmail.com>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('herzult_forum');
$rootNode
->children()
->scalarNode('db_driver')
->isRequired()
->validate()
->ifNotInArray(array('orm', 'odm'))
->thenInvalid('The database driver must be either \'orm\' or \'odm\'.')
->end()
->end()
->arrayNode('class')
->isRequired()
->addDefaultsIfNotSet()
->children()
->arrayNode('model')
->isRequired()
->children()
->scalarNode('category')->isRequired()->end()
->scalarNode('topic')->isRequired()->end()
->scalarNode('post')->isRequired()->end()
->end()
->end()
->arrayNode('form')
->addDefaultsIfNotSet()
->children()
->scalarNode('new_topic')->defaultValue('Herzult\Bundle\ForumBundle\Form\NewTopicFormType')->end()
->scalarNode('first_post')->defaultValue('Herzult\Bundle\ForumBundle\Form\PostFormType')->end()
->scalarNode('post')->defaultValue('Herzult\Bundle\ForumBundle\Form\PostFormType')->end()
->scalarNode('search')->defaultValue('Herzult\Bundle\ForumBundle\Form\SearchFormType')->end()
->end()
->end()
->arrayNode('controller')
->addDefaultsIfNotSet()
->children()
->scalarNode('forum')->defaultValue('Herzult\Bundle\ForumBundle\Controller\ForumController')->end()
->scalarNode('category')->defaultValue('Herzult\Bundle\ForumBundle\Controller\CategoryController')->end()
->scalarNode('topic')->defaultValue('Herzult\Bundle\ForumBundle\Controller\TopicController')->end()
->scalarNode('post')->defaultValue('Herzult\Bundle\ForumBundle\Controller\PostController')->end()
->end()
->end()
->arrayNode('creator')
->addDefaultsIfNotSet()
->children()
->scalarNode('topic')->defaultValue('Herzult\Bundle\ForumBundle\Creator\TopicCreator')->end()
->scalarNode('post')->defaultValue('Herzult\Bundle\ForumBundle\Creator\PostCreator')->end()
->end()
->end()
->arrayNode('blamer')
->addDefaultsIfNotSet()
->children()
->scalarNode('topic')->defaultValue('Herzult\Bundle\ForumBundle\Blamer\TopicBlamer')->end()
->scalarNode('post')->defaultValue('Herzult\Bundle\ForumBundle\Blamer\PostBlamer')->end()
->end()
->end()
->arrayNode('updater')
->addDefaultsIfNotSet()
->children()
->scalarNode('category')->defaultValue('Herzult\Bundle\ForumBundle\Updater\CategoryUpdater')->end()
->scalarNode('topic')->defaultValue('Herzult\Bundle\ForumBundle\Updater\TopicUpdater')->end()
->end()
->end()
->arrayNode('remover')
->addDefaultsIfNotSet()
->children()
->scalarNode('topic')->defaultValue('Herzult\Bundle\ForumBundle\Remover\TopicRemover')->end()
->scalarNode('post')->defaultValue('Herzult\Bundle\ForumBundle\Remover\PostRemover')->end()
->end()
->end()
->arrayNode('twig')
->addDefaultsIfNotSet()
->children()
->scalarNode('extension')->defaultValue('Herzult\Bundle\ForumBundle\Twig\ForumExtension')->end()
->end()
->end()
->arrayNode('router')
->addDefaultsIfNotSet()
->children()
->scalarNode('url_generator')->defaultValue('Herzult\Bundle\ForumBundle\Router\ForumUrlGenerator')->end()
->end()
->end()
->end()
->end()
->arrayNode('form_name')
->addDefaultsIfNotSet()
->children()
->scalarNode('new_topic')->defaultValue('forum_new_topic_form')->end()
->scalarNode('first_post')->defaultValue('firstPost')->end()
->scalarNode('post')->defaultValue('forum_post_form')->end()
->scalarNode('search')->defaultValue('forum_search')->end()
->end()
->end()
->arrayNode('paginator')
->addDefaultsIfNotSet()
->children()
->scalarNode('posts_per_page')->defaultValue(10)->end()
->scalarNode('topics_per_page')->defaultValue(10)->end()
->scalarNode('search_results_per_page')->defaultValue(10)->end()
->end()
->end()
->arrayNode('templating')
->addDefaultsIfNotSet()
->children()
->arrayNode('location')
->addDefaultsIfNotSet()
->children()
->scalarNode('category')->defaultValue('HerzultForumBundle:Category')->end()
->scalarNode('forum')->defaultValue('HerzultForumBundle:Forum')->end()
->scalarNode('post')->defaultValue('HerzultForumBundle:Post')->end()
->scalarNode('topic')->defaultValue('HerzultForumBundle:Topic')->end()
->end()
->end()
->scalarNode('engine')
->defaultValue('twig')
->validate()
->ifNotInArray(array('twig', 'php'))
->thenInvalid('The templating engine must be either \'twig\' or \'php\'.')
->end()
->end()
->scalarNode('theme')->defaultValue('Twig::form.html.twig')->end()
->end()
->end()
->end()
;
return $treeBuilder;
}
}