Skip to content

Commit dd2788c

Browse files
committed
minor #10749 [Forms] Improved compound option description (vudaltsov)
This PR was squashed before being merged into the 3.4 branch (closes #10749). Discussion ---------- [Forms] Improved compound option description #SymfonyConHackday2018 Corrections for #9283. Thanx a lot to @HeahDude and @javiereguiluz ! Commits ------- 12e9334 [Forms] Improved compound option description
2 parents 5dff4ee + 12e9334 commit dd2788c

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

reference/forms/types/options/compound.rst.inc

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,14 @@ compound
33

44
**type**: ``boolean`` **default**: ``true``
55

6-
If ``true`` this option creates the form as "compound", meaning that it
7-
can contain children and be a parent of other forms.
6+
A compound form can be either an entire ``<form>`` element or a group of form fields (rendered
7+
for example inside a ``<div>`` or ``<tr>`` container elements). Compound forms use the
8+
DataMapperInterface to initialize their children or to write back their submitted data.
89

9-
Most of the time you won't need to override this option.
10-
You might want to control for it when creating a custom form type
11-
with advanced rendering logic.
12-
13-
In a view a compound form is rendered as a ``<div>`` container or
14-
a ``<form>`` element (the whole form is obviously a compound form).
15-
16-
Non-compound forms are always leaves in a form tree, they cannot have children.
17-
18-
A non-compound form is rendered as one of the html form elements: ``<input>``
10+
A simple (non-compound) form is rendered as any of these HTML elements: ``<input>``
1911
(``TextType``, ``FileType``, ``HiddenType``), ``<textarea>`` (``TextareaType``)
2012
or ``<select>`` (``ChoiceType``).
2113

22-
An interesting case is the ``ChoiceType``. With ``expanded=false`` it is a non-compound form
23-
and is rendered as a ``<select>`` tag. With ``expanded=true`` the ``ChoiceType`` becomes a
24-
compound form and is rendered as a set of radios or checkboxes.
14+
Some core types like date related types or the ``ChoiceType`` are simple or compound depending
15+
on other options (such as ``expanded`` or ``widget``). They will either behave as a simple text
16+
field or as a group of text or choice fields.

0 commit comments

Comments
 (0)