@@ -17,10 +17,10 @@ photos).
17
17
| Options | - `allow_add `_ |
18
18
| | - `allow_delete `_ |
19
19
| | - `delete_empty `_ |
20
- | | - `options `_ |
20
+ | | - `entry_options `_ |
21
+ | | - `entry_type `_ |
21
22
| | - `prototype `_ |
22
23
| | - `prototype_name `_ |
23
- | | - `type `_ |
24
24
+-------------+-----------------------------------------------------------------------------+
25
25
| Inherited | - `by_reference `_ |
26
26
| options | - `cascade_validation `_ |
@@ -53,10 +53,10 @@ to an array of email addresses. In the form, you want to expose each email
53
53
address as its own input text box::
54
54
55
55
$builder->add('emails', 'collection', array(
56
- // each item in the array will be an "email" field
57
- 'type ' => 'email',
56
+ // each entry in the array will be an "email" field
57
+ 'entry_type ' => 'email',
58
58
// these options are passed to each "email" type
59
- 'options ' => array(
59
+ 'entry_options ' => array(
60
60
'required' => false,
61
61
'attr' => array('class' => 'email-box')
62
62
),
@@ -273,20 +273,24 @@ form you have to set this option to true. However, existing collection entries
273
273
will only be deleted if you have the allow_delete _ option enabled. Otherwise
274
274
the empty values will be kept.
275
275
276
- options
277
- ~~~~~~~
276
+ entry_options
277
+ ~~~~~~~~~~~~~
278
+
279
+ .. versionadded :: 2.7
280
+ The ``entry_options `` option was introduced in Symfony 2.7 in favor of
281
+ ``options ``, which is available prior to 2.7.
278
282
279
283
**type **: ``array `` **default **: ``array() ``
280
284
281
- This is the array that's passed to the form type specified in the `type `_
285
+ This is the array that's passed to the form type specified in the `entry_type `_
282
286
option. For example, if you used the :doc: `choice </reference/forms/types/choice >`
283
- type as your `type `_ option (e.g. for a collection of drop-down menus),
287
+ type as your `entry_type `_ option (e.g. for a collection of drop-down menus),
284
288
then you'd need to at least pass the ``choices `` option to the underlying
285
289
type::
286
290
287
291
$builder->add('favorite_cities', 'collection', array(
288
- 'type ' => 'choice',
289
- 'options ' => array(
292
+ 'entry_type ' => 'choice',
293
+ 'entry_options ' => array(
290
294
'choices' => array(
291
295
'nashville' => 'Nashville',
292
296
'paris' => 'Paris',
@@ -296,6 +300,21 @@ type::
296
300
),
297
301
));
298
302
303
+ entry_type
304
+ ~~~~~~~~~~
305
+
306
+ .. versionadded :: 2.7
307
+ The ``entry_type `` option was introduced in Symfony 2.7 in favor of
308
+ ``type ``, which is available prior to 2.7.
309
+
310
+ **type **: ``string `` or :class: `Symfony\\ Component\\ Form\\ FormTypeInterface ` **required **
311
+
312
+ This is the field type for each item in this collection (e.g. ``text ``,
313
+ ``choice ``, etc). For example, if you have an array of email addresses,
314
+ you'd use the :doc: `email </reference/forms/types/email >` type. If you want
315
+ to embed a collection of some other form, create a new instance of your
316
+ form type and pass it as this option.
317
+
299
318
prototype
300
319
~~~~~~~~~
301
320
@@ -344,17 +363,6 @@ If you have several collections in your form, or worse, nested collections
344
363
you may want to change the placeholder so that unrelated placeholders are
345
364
not replaced with the same value.
346
365
347
- type
348
- ~~~~
349
-
350
- **type **: ``string `` or :class: `Symfony\\ Component\\ Form\\ FormTypeInterface ` **required **
351
-
352
- This is the field type for each item in this collection (e.g. ``text ``,
353
- ``choice ``, etc). For example, if you have an array of email addresses,
354
- you'd use the :doc: `email </reference/forms/types/email >` type. If you want
355
- to embed a collection of some other form, create a new instance of your
356
- form type and pass it as this option.
357
-
358
366
Inherited Options
359
367
-----------------
360
368
0 commit comments