]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
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 | /** | |
15 | * The configuration of a {@link Form} object. | |
16 | * | |
17 | * @author Bernhard Schussek <bschussek@gmail.com> | |
18 | */ | |
19 | interface FormConfigInterface | |
20 | { | |
21 | /** | |
22 | * Returns the event dispatcher used to dispatch form events. | |
23 | * | |
24 | * @return \Symfony\Component\EventDispatcher\EventDispatcherInterface The dispatcher. | |
25 | */ | |
26 | public function getEventDispatcher(); | |
27 | ||
28 | /** | |
29 | * Returns the name of the form used as HTTP parameter. | |
30 | * | |
31 | * @return string The form name. | |
32 | */ | |
33 | public function getName(); | |
34 | ||
35 | /** | |
36 | * Returns the property path that the form should be mapped to. | |
37 | * | |
38 | * @return null|\Symfony\Component\PropertyAccess\PropertyPathInterface The property path. | |
39 | */ | |
40 | public function getPropertyPath(); | |
41 | ||
42 | /** | |
43 | * Returns whether the form should be mapped to an element of its | |
44 | * parent's data. | |
45 | * | |
46 | * @return Boolean Whether the form is mapped. | |
47 | */ | |
48 | public function getMapped(); | |
49 | ||
50 | /** | |
51 | * Returns whether the form's data should be modified by reference. | |
52 | * | |
53 | * @return Boolean Whether to modify the form's data by reference. | |
54 | */ | |
55 | public function getByReference(); | |
56 | ||
57 | /** | |
58 | * Returns whether the form should read and write the data of its parent. | |
59 | * | |
60 | * @return Boolean Whether the form should inherit its parent's data. | |
61 | */ | |
62 | public function getInheritData(); | |
63 | ||
64 | /** | |
65 | * Returns whether the form is compound. | |
66 | * | |
67 | * This property is independent of whether the form actually has | |
68 | * children. A form can be compound and have no children at all, like | |
69 | * for example an empty collection form. | |
70 | * | |
71 | * @return Boolean Whether the form is compound. | |
72 | */ | |
73 | public function getCompound(); | |
74 | ||
75 | /** | |
76 | * Returns the form types used to construct the form. | |
77 | * | |
78 | * @return ResolvedFormTypeInterface The form's type. | |
79 | */ | |
80 | public function getType(); | |
81 | ||
82 | /** | |
83 | * Returns the view transformers of the form. | |
84 | * | |
85 | * @return DataTransformerInterface[] An array of {@link DataTransformerInterface} instances. | |
86 | */ | |
87 | public function getViewTransformers(); | |
88 | ||
89 | /** | |
90 | * Returns the model transformers of the form. | |
91 | * | |
92 | * @return DataTransformerInterface[] An array of {@link DataTransformerInterface} instances. | |
93 | */ | |
94 | public function getModelTransformers(); | |
95 | ||
96 | /** | |
97 | * Returns the data mapper of the form. | |
98 | * | |
99 | * @return DataMapperInterface The data mapper. | |
100 | */ | |
101 | public function getDataMapper(); | |
102 | ||
103 | /** | |
104 | * Returns whether the form is required. | |
105 | * | |
106 | * @return Boolean Whether the form is required. | |
107 | */ | |
108 | public function getRequired(); | |
109 | ||
110 | /** | |
111 | * Returns whether the form is disabled. | |
112 | * | |
113 | * @return Boolean Whether the form is disabled. | |
114 | */ | |
115 | public function getDisabled(); | |
116 | ||
117 | /** | |
118 | * Returns whether errors attached to the form will bubble to its parent. | |
119 | * | |
120 | * @return Boolean Whether errors will bubble up. | |
121 | */ | |
122 | public function getErrorBubbling(); | |
123 | ||
124 | /** | |
125 | * Returns the data that should be returned when the form is empty. | |
126 | * | |
127 | * @return mixed The data returned if the form is empty. | |
128 | */ | |
129 | public function getEmptyData(); | |
130 | ||
131 | /** | |
132 | * Returns additional attributes of the form. | |
133 | * | |
134 | * @return array An array of key-value combinations. | |
135 | */ | |
136 | public function getAttributes(); | |
137 | ||
138 | /** | |
139 | * Returns whether the attribute with the given name exists. | |
140 | * | |
141 | * @param string $name The attribute name. | |
142 | * | |
143 | * @return Boolean Whether the attribute exists. | |
144 | */ | |
145 | public function hasAttribute($name); | |
146 | ||
147 | /** | |
148 | * Returns the value of the given attribute. | |
149 | * | |
150 | * @param string $name The attribute name. | |
151 | * @param mixed $default The value returned if the attribute does not exist. | |
152 | * | |
153 | * @return mixed The attribute value. | |
154 | */ | |
155 | public function getAttribute($name, $default = null); | |
156 | ||
157 | /** | |
158 | * Returns the initial data of the form. | |
159 | * | |
160 | * @return mixed The initial form data. | |
161 | */ | |
162 | public function getData(); | |
163 | ||
164 | /** | |
165 | * Returns the class of the form data or null if the data is scalar or an array. | |
166 | * | |
167 | * @return string The data class or null. | |
168 | */ | |
169 | public function getDataClass(); | |
170 | ||
171 | /** | |
172 | * Returns whether the form's data is locked. | |
173 | * | |
174 | * A form with locked data is restricted to the data passed in | |
175 | * this configuration. The data can only be modified then by | |
176 | * submitting the form. | |
177 | * | |
178 | * @return Boolean Whether the data is locked. | |
179 | */ | |
180 | public function getDataLocked(); | |
181 | ||
182 | /** | |
183 | * Returns the form factory used for creating new forms. | |
184 | * | |
185 | * @return FormFactoryInterface The form factory. | |
186 | */ | |
187 | public function getFormFactory(); | |
188 | ||
189 | /** | |
190 | * Returns the target URL of the form. | |
191 | * | |
192 | * @return string The target URL of the form. | |
193 | */ | |
194 | public function getAction(); | |
195 | ||
196 | /** | |
197 | * Returns the HTTP method used by the form. | |
198 | * | |
199 | * @return string The HTTP method of the form. | |
200 | */ | |
201 | public function getMethod(); | |
202 | ||
203 | /** | |
204 | * Returns the request handler used by the form. | |
205 | * | |
206 | * @return RequestHandlerInterface The request handler. | |
207 | */ | |
208 | public function getRequestHandler(); | |
209 | ||
210 | /** | |
211 | * Returns whether the form should be initialized upon creation. | |
212 | * | |
213 | * @return Boolean Returns true if the form should be initialized | |
214 | * when created, false otherwise. | |
215 | */ | |
216 | public function getAutoInitialize(); | |
217 | ||
218 | /** | |
219 | * Returns all options passed during the construction of the form. | |
220 | * | |
221 | * @return array The passed options. | |
222 | */ | |
223 | public function getOptions(); | |
224 | ||
225 | /** | |
226 | * Returns whether a specific option exists. | |
227 | * | |
228 | * @param string $name The option name, | |
229 | * | |
230 | * @return Boolean Whether the option exists. | |
231 | */ | |
232 | public function hasOption($name); | |
233 | ||
234 | /** | |
235 | * Returns the value of a specific option. | |
236 | * | |
237 | * @param string $name The option name. | |
238 | * @param mixed $default The value returned if the option does not exist. | |
239 | * | |
240 | * @return mixed The option value. | |
241 | */ | |
242 | public function getOption($name, $default = null); | |
243 | } |