We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
prototype_data
1 parentf6fe783 commitbefaeb4Copy full SHA for befaeb4
reference/forms/types/collection.rst
@@ -369,8 +369,23 @@ prototype_data
369
370
**type**: ``mixed`` **default**: ``null``
371
372
-Allows you to specify data for the prototype. Each new row added will initially
373
-contain the data set by this option.
+Allows you to define a specific data for the prototype. Each new row added will
+initially contain the data set by this option.
374
+By default, the same data as defined with ``entry_options`` for other entries
375
+will be used.
376
+
377
+ ..code-block::php
378
379
+ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
380
+ use Symfony\Component\Form\Extension\Core\Type\TextType;
381
382
+ $builder->add('tags', CollectionType::class, array(
383
+ 'class' =>\AppBundle\Entity\Tag::class,
384
+ 'entry_type' => TextType::class,
385
+ 'allow_add' => true,
386
+ 'prototype' => true,
387
+ 'prototype_data' => 'New Tag Placeholder',
388
+ ));
389
390
prototype_name
391
~~~~~~~~~~~~~~