File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -367,10 +367,27 @@ 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+ $builder->add('tags', CollectionType::class, array(
385+ 'class' => 'AppBundle\Entity\Tag',
386+ 'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
387+ 'allow_add' => true,
388+ 'prototype' => true,
389+ 'prototype_data' => 'New Tag Placeholder',
390+ ));
374391
375392 prototype_name
376393~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments