]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/form/Symfony/Component/Form/FormConfigBuilderInterface.php
twig implementation
[github/wallabag/wallabag.git] / vendor / symfony / form / Symfony / Component / Form / FormConfigBuilderInterface.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
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 Symfony\Component\Form;
13
14 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15
16 /**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19 interface FormConfigBuilderInterface extends FormConfigInterface
20 {
21 /**
22 * Adds an event listener to an event on this form.
23 *
24 * @param string $eventName The name of the event to listen to.
25 * @param callable $listener The listener to execute.
26 * @param integer $priority The priority of the listener. Listeners
27 * with a higher priority are called before
28 * listeners with a lower priority.
29 *
30 * @return self The configuration object.
31 */
32 public function addEventListener($eventName, $listener, $priority = 0);
33
34 /**
35 * Adds an event subscriber for events on this form.
36 *
37 * @param EventSubscriberInterface $subscriber The subscriber to attach.
38 *
39 * @return self The configuration object.
40 */
41 public function addEventSubscriber(EventSubscriberInterface $subscriber);
42
43 /**
44 * Appends / prepends a transformer to the view transformer chain.
45 *
46 * The transform method of the transformer is used to convert data from the
47 * normalized to the view format.
48 * The reverseTransform method of the transformer is used to convert from the
49 * view to the normalized format.
50 *
51 * @param DataTransformerInterface $viewTransformer
52 * @param Boolean $forcePrepend if set to true, prepend instead of appending
53 *
54 * @return self The configuration object.
55 */
56 public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false);
57
58 /**
59 * Clears the view transformers.
60 *
61 * @return self The configuration object.
62 */
63 public function resetViewTransformers();
64
65 /**
66 * Prepends / appends a transformer to the normalization transformer chain.
67 *
68 * The transform method of the transformer is used to convert data from the
69 * model to the normalized format.
70 * The reverseTransform method of the transformer is used to convert from the
71 * normalized to the model format.
72 *
73 * @param DataTransformerInterface $modelTransformer
74 * @param Boolean $forceAppend if set to true, append instead of prepending
75 *
76 * @return self The configuration object.
77 */
78 public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false);
79
80 /**
81 * Clears the normalization transformers.
82 *
83 * @return self The configuration object.
84 */
85 public function resetModelTransformers();
86
87 /**
88 * Sets the value for an attribute.
89 *
90 * @param string $name The name of the attribute
91 * @param string $value The value of the attribute
92 *
93 * @return self The configuration object.
94 */
95 public function setAttribute($name, $value);
96
97 /**
98 * Sets the attributes.
99 *
100 * @param array $attributes The attributes.
101 *
102 * @return self The configuration object.
103 */
104 public function setAttributes(array $attributes);
105
106 /**
107 * Sets the data mapper used by the form.
108 *
109 * @param DataMapperInterface $dataMapper
110 *
111 * @return self The configuration object.
112 */
113 public function setDataMapper(DataMapperInterface $dataMapper = null);
114
115 /**
116 * Set whether the form is disabled.
117 *
118 * @param Boolean $disabled Whether the form is disabled
119 *
120 * @return self The configuration object.
121 */
122 public function setDisabled($disabled);
123
124 /**
125 * Sets the data used for the client data when no value is submitted.
126 *
127 * @param mixed $emptyData The empty data.
128 *
129 * @return self The configuration object.
130 */
131 public function setEmptyData($emptyData);
132
133 /**
134 * Sets whether errors bubble up to the parent.
135 *
136 * @param Boolean $errorBubbling
137 *
138 * @return self The configuration object.
139 */
140 public function setErrorBubbling($errorBubbling);
141
142 /**
143 * Sets whether this field is required to be filled out when submitted.
144 *
145 * @param Boolean $required
146 *
147 * @return self The configuration object.
148 */
149 public function setRequired($required);
150
151 /**
152 * Sets the property path that the form should be mapped to.
153 *
154 * @param null|string|\Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath
155 * The property path or null if the path should be set
156 * automatically based on the form's name.
157 *
158 * @return self The configuration object.
159 */
160 public function setPropertyPath($propertyPath);
161
162 /**
163 * Sets whether the form should be mapped to an element of its
164 * parent's data.
165 *
166 * @param Boolean $mapped Whether the form should be mapped.
167 *
168 * @return self The configuration object.
169 */
170 public function setMapped($mapped);
171
172 /**
173 * Sets whether the form's data should be modified by reference.
174 *
175 * @param Boolean $byReference Whether the data should be
176 * modified by reference.
177 *
178 * @return self The configuration object.
179 */
180 public function setByReference($byReference);
181
182 /**
183 * Sets whether the form should read and write the data of its parent.
184 *
185 * @param Boolean $inheritData Whether the form should inherit its parent's data.
186 *
187 * @return self The configuration object.
188 */
189 public function setInheritData($inheritData);
190
191 /**
192 * Sets whether the form should be compound.
193 *
194 * @param Boolean $compound Whether the form should be compound.
195 *
196 * @return self The configuration object.
197 *
198 * @see FormConfigInterface::getCompound()
199 */
200 public function setCompound($compound);
201
202 /**
203 * Set the types.
204 *
205 * @param ResolvedFormTypeInterface $type The type of the form.
206 *
207 * @return self The configuration object.
208 */
209 public function setType(ResolvedFormTypeInterface $type);
210
211 /**
212 * Sets the initial data of the form.
213 *
214 * @param array $data The data of the form in application format.
215 *
216 * @return self The configuration object.
217 */
218 public function setData($data);
219
220 /**
221 * Locks the form's data to the data passed in the configuration.
222 *
223 * A form with locked data is restricted to the data passed in
224 * this configuration. The data can only be modified then by
225 * submitting the form.
226 *
227 * @param Boolean $locked Whether to lock the default data.
228 *
229 * @return self The configuration object.
230 */
231 public function setDataLocked($locked);
232
233 /**
234 * Sets the form factory used for creating new forms.
235 *
236 * @param FormFactoryInterface $formFactory The form factory.
237 */
238 public function setFormFactory(FormFactoryInterface $formFactory);
239
240 /**
241 * Sets the target URL of the form.
242 *
243 * @param string $action The target URL of the form.
244 *
245 * @return self The configuration object.
246 */
247 public function setAction($action);
248
249 /**
250 * Sets the HTTP method used by the form.
251 *
252 * @param string $method The HTTP method of the form.
253 *
254 * @return self The configuration object.
255 */
256 public function setMethod($method);
257
258 /**
259 * Sets the request handler used by the form.
260 *
261 * @param RequestHandlerInterface $requestHandler
262 *
263 * @return self The configuration object.
264 */
265 public function setRequestHandler(RequestHandlerInterface $requestHandler);
266
267 /**
268 * Sets whether the form should be initialized automatically.
269 *
270 * Should be set to true only for root forms.
271 *
272 * @param Boolean $initialize True to initialize the form automatically,
273 * false to suppress automatic initialization.
274 * In the second case, you need to call
275 * {@link FormInterface::initialize()} manually.
276 *
277 * @return self The configuration object.
278 */
279 public function setAutoInitialize($initialize);
280
281 /**
282 * Builds and returns the form configuration.
283 *
284 * @return FormConfigInterface
285 */
286 public function getFormConfig();
287 }