File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -367,10 +367,28 @@ well as :ref:`cookbook-form-collections-new-prototype`.
367367prototype_data
368368~~~~~~~~~~~~~~
369369
370+ .. versionadded :: 2.8
371+ The ``prototype_data `` option was introduced in Symfony 2.8.
372+
370373**type **: ``mixed `` **default **: ``null ``
371374
372- Allows you to specify data for the prototype. Each new row added will initially
373- contain the data set by this option.
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+ 'class' => 'AppBundle\Entity\Tag',
387+ 'entry_type' => TextType::class,
388+ 'allow_add' => true,
389+ 'prototype' => true,
390+ 'prototype_data' => 'New Tag Placeholder',
391+ ));
374392
375393 prototype_name
376394~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments