Skip to content

Commit cd2abbb

Browse files
committed
minor #9283 [Form] Compound option explained (vudaltsov)
This PR was squashed before being merged into the 2.7 branch (closes #9283). Discussion ---------- [Form] Compound option explained Closes #5213 ping @HeahDude , @wouterj , @xabbuh Commits ------- 977dfb9 [Form] Compound option explained
2 parents 1a90234 + 977dfb9 commit cd2abbb

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ compound
33

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

6-
This option specifies if a form is compound. This is independent of whether
7-
the form actually has children. A form can be compound but not have any
8-
children at all (e.g. an empty collection form).
6+
If ``true`` this option creates the form as "compound", meaning that it
7+
can contain children and be a parent of other forms.
8+
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>``
19+
(``TextType``, ``FileType``, ``HiddenType``), ``<textarea>`` (``TextareaType``)
20+
or ``<select>`` (``ChoiceType``).
21+
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.

0 commit comments

Comments
 (0)