Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbefaeb4

Browse files
committed
[Form] defined default and added example CollectionTypeprototype_data option
1 parentf6fe783 commitbefaeb4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

‎reference/forms/types/collection.rst‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,23 @@ prototype_data
369369

370370
**type**: ``mixed`` **default**: ``null``
371371

372-
Allows you to specify data for the prototype. Each new row added will initially
373-
contain the data set by this option.
372+
Allows you to define a specific data for the prototype. Each new row added will
373+
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+
));
374389

375390
prototype_name
376391
~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp