Skip to content

Commit 259b254

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: [Forms] Improved compound option description Fix syntax error in example Fix TextType empty_data value explanation
2 parents d460894 + 366a653 commit 259b254

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
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.

reference/forms/types/text.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
4646
.. include:: /reference/forms/types/options/empty_data.rst.inc
4747
:end-before: DEFAULT_PLACEHOLDER
4848

49-
The default value is ``''`` (the empty string).
49+
From an HTTP perspective, submitted data is always a string or an array of strings.
50+
So by default, the form will treat any empty string as null. If you prefer to get
51+
an empty string, explicitly set the ``empty_data`` option to an empty string.
5052

5153
.. include:: /reference/forms/types/options/empty_data.rst.inc
5254
:start-after: DEFAULT_PLACEHOLDER

service_container/service_decoration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,6 @@ the ``decoration_priority`` option. Its value is an integer that defaults to
285285
286286
The generated code will be the following::
287287

288-
$this->services[Foo:class] = new Baz(new Bar(new Foo()));
288+
$this->services[Foo::class] = new Baz(new Bar(new Foo()));
289289

290290
.. _decorator pattern: https://en.wikipedia.org/wiki/Decorator_pattern

0 commit comments

Comments
 (0)