1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace steevanb\SymfonyFormOptionsBuilder\FormOptionsBuilder; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; |
6
|
|
|
|
7
|
|
|
class RootFormOptionsBuilder extends FormOptionsBuilder implements RootFormOptionsBuilderInterface |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @param string $name |
11
|
|
|
* @return $this |
12
|
|
|
*/ |
13
|
|
|
public function setCsrfFieldName($name) |
14
|
|
|
{ |
15
|
|
|
return $this->setOption('csrf_field_name', $name); |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @return string |
20
|
|
|
*/ |
21
|
|
|
public function getCsrfFieldName() |
22
|
|
|
{ |
23
|
|
|
return $this->getOption('csrf_field_name'); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return $this |
28
|
|
|
*/ |
29
|
|
|
public function removeCsrfFieldName() |
30
|
|
|
{ |
31
|
|
|
return $this->removeOption('csrf_field_name'); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param string $message |
36
|
|
|
* @return $this |
37
|
|
|
*/ |
38
|
|
|
public function setCsrfMessage($message) |
39
|
|
|
{ |
40
|
|
|
return $this->setOption('csrf_message', $message); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return string |
45
|
|
|
*/ |
46
|
|
|
public function getCsrfMessage() |
47
|
|
|
{ |
48
|
|
|
return $this->getOption('csrf_message'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return $this |
53
|
|
|
*/ |
54
|
|
|
public function removeCsrfMessage() |
55
|
|
|
{ |
56
|
|
|
return $this->removeOption('csrf_message'); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param bool $protection |
61
|
|
|
* @return $this |
62
|
|
|
*/ |
63
|
|
|
public function setCsrfProtection($protection = true) |
64
|
|
|
{ |
65
|
|
|
return $this->setOption('csrf_protection', $protection); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return bool |
70
|
|
|
*/ |
71
|
|
|
public function getCsrfProtection() |
72
|
|
|
{ |
73
|
|
|
return $this->getOption('csrf_protection'); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return $this |
78
|
|
|
*/ |
79
|
|
|
public function removeCsrfProtection() |
80
|
|
|
{ |
81
|
|
|
return $this->removeOption('csrf_protection'); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param CsrfTokenManagerInterface $provider |
86
|
|
|
* @return $this |
87
|
|
|
*/ |
88
|
|
|
public function setCsrfProvider(CsrfTokenManagerInterface $provider) |
89
|
|
|
{ |
90
|
|
|
return $this->setOption('csrf_provider', $provider); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return CsrfTokenManagerInterface|string |
95
|
|
|
*/ |
96
|
|
|
public function getCsrfProvider() |
97
|
|
|
{ |
98
|
|
|
return $this->getOption('csrf_provider'); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return $this |
103
|
|
|
*/ |
104
|
|
|
public function removeCsrfProvider() |
105
|
|
|
{ |
106
|
|
|
return $this->removeOption('csrf_provider'); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param string $id |
111
|
|
|
* @return $this |
112
|
|
|
*/ |
113
|
|
|
public function setCsrfTokenId($id) |
114
|
|
|
{ |
115
|
|
|
return $this->setOption('csrf_token_id', $id); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return string |
120
|
|
|
*/ |
121
|
|
|
public function getCsrfTokenId() |
122
|
|
|
{ |
123
|
|
|
return $this->getOption('csrf_token_id'); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return $this |
128
|
|
|
*/ |
129
|
|
|
public function removeCsrfTokenId() |
130
|
|
|
{ |
131
|
|
|
return $this->removeOption('csrf_token_id'); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @param CsrfTokenManagerInterface $manager |
136
|
|
|
* @return $this |
137
|
|
|
*/ |
138
|
|
|
public function setCsrfTokenManager(CsrfTokenManagerInterface $manager) |
139
|
|
|
{ |
140
|
|
|
return $this->setOption('csrf_token_manager', $manager); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @return CsrfTokenManagerInterface|string |
145
|
|
|
*/ |
146
|
|
|
public function getCsrfTokenManager() |
147
|
|
|
{ |
148
|
|
|
return $this->getOption('csrf_token_manager'); |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @return $this |
153
|
|
|
*/ |
154
|
|
|
public function removeCsrfTokenManager() |
155
|
|
|
{ |
156
|
|
|
return $this->removeOption('csrf_token_manager'); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param string $method |
161
|
|
|
* @return $this |
162
|
|
|
* @link http://symfony.com/doc/current/reference/forms/types/form.html#post-max-size-message |
163
|
|
|
*/ |
164
|
|
|
public function setMethod($method) |
165
|
|
|
{ |
166
|
|
|
return $this->setOption('method', $method); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @return string |
171
|
|
|
* @link http://symfony.com/doc/current/reference/forms/types/form.html#post-max-size-message |
172
|
|
|
*/ |
173
|
|
|
public function getMethod() |
174
|
|
|
{ |
175
|
|
|
return $this->getOption('method'); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @return $this |
180
|
|
|
* @link http://symfony.com/doc/current/reference/forms/types/form.html#post-max-size-message |
181
|
|
|
*/ |
182
|
|
|
public function removeMethod() |
183
|
|
|
{ |
184
|
|
|
return $this->removeOption('method'); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @param string $message |
189
|
|
|
* @return $this |
190
|
|
|
* @link http://symfony.com/doc/current/reference/forms/types/form.html#post-max-size-message |
191
|
|
|
*/ |
192
|
|
|
public function setPostMaxSizeMessage($message) |
193
|
|
|
{ |
194
|
|
|
return $this->setOption('post_max_size_message', $message); |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @return string |
199
|
|
|
* @link http://symfony.com/doc/current/reference/forms/types/form.html#post-max-size-message |
200
|
|
|
*/ |
201
|
|
|
public function getPostMaxSizeMessage() |
202
|
|
|
{ |
203
|
|
|
return $this->getOption('post_max_size_message'); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @return $this |
208
|
|
|
* @link http://symfony.com/doc/current/reference/forms/types/form.html#post-max-size-message |
209
|
|
|
*/ |
210
|
|
|
public function removePostMaxSizeMessage() |
211
|
|
|
{ |
212
|
|
|
return $this->removeOption('post_max_size_message'); |
213
|
|
|
} |
214
|
|
|
} |
215
|
|
|
|