File tree 1 file changed +26
-0
lines changed 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ photos).
20
20
| | - `entry_options `_ |
21
21
| | - `entry_type `_ |
22
22
| | - `prototype `_ |
23
+ | | - `prototype_data `_ |
23
24
| | - `prototype_name `_ |
24
25
+-------------+-----------------------------------------------------------------------------+
25
26
| Inherited | - `by_reference `_ |
@@ -363,6 +364,31 @@ rendering your form, having the entire "form row" may be easier for you.
363
364
For details on how to actually use this option, see the above example as
364
365
well as :ref: `cookbook-form-collections-new-prototype `.
365
366
367
+ prototype_data
368
+ ~~~~~~~~~~~~~~
369
+
370
+ .. versionadded :: 2.8
371
+ The ``prototype_data `` option was introduced in Symfony 2.8.
372
+
373
+ **type **: ``mixed `` **default **: ``null ``
374
+
375
+ Allows you to define specific data for the prototype. Each new row added will
376
+ initially contain the data set by this option. By default, the data configured
377
+ for all entries with the ``entry_options `` option will be used.
378
+
379
+ .. code-block :: php
380
+
381
+ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
382
+ use Symfony\Component\Form\Extension\Core\Type\TextType;
383
+ // ...
384
+
385
+ $builder->add('tags', CollectionType::class, array(
386
+ 'entry_type' => TextType::class,
387
+ 'allow_add' => true,
388
+ 'prototype' => true,
389
+ 'prototype_data' => 'New Tag Placeholder',
390
+ ));
391
+
366
392
prototype_name
367
393
~~~~~~~~~~~~~~
368
394
You can’t perform that action at this time.
0 commit comments