Skip to content

Commit bb371c5

Browse files
committed
[#2397] Adding more empty_data details from previous changes that were removed when merging into 2.1
1 parent e6347d5 commit bb371c5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ empty_data
66
This option determines what value the field will return when the ``empty_value``
77
choice is selected.
88

9+
The true default value of this option depends on the field options:
10+
11+
* If ``compound`` is ``true`` and ``data_class`` is set, then ``new $data_class()``;
12+
* If ``compound`` is ``true`` and no ``data_class`` is set, then ``array()``;
13+
* If ``compound`` is ``false``, then ``null``.
14+
15+
.. tip::
16+
17+
The ``compound`` option is set to ``true`` when the field actually represents
18+
a collection of fields (e.g. a form of fields).
19+
920
For example, if you want the ``gender`` field to be set to ``null`` when no
1021
value is selected, you can do it like this:
1122

0 commit comments

Comments
 (0)