Skip to content

Commit f8ad18b

Browse files
committed
Merge branch 'form_overriden_options_20' of github.com:WouterJ/symfony-docs into WouterJ-form_overriden_options_20
Conflicts: reference/forms/types/birthday.rst reference/forms/types/choice.rst reference/forms/types/date.rst reference/forms/types/time.rst
2 parents b84abc6 + f44ca12 commit f8ad18b

File tree

13 files changed

+223
-38
lines changed

13 files changed

+223
-38
lines changed

reference/forms/types/birthday.rst

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,33 @@ This type is essentially the same as the :doc:`date</reference/forms/types/date>
1414
type, but with a more appropriate default for the `years`_ option. The `years`_
1515
option defaults to 120 years ago to the current year.
1616

17-
+----------------------+------------------------------------------------------------------------------------------------------------------------+
18-
| Underlying Data Type | can be ``DateTime``, ``string``, ``timestamp``, or ``array`` (see the :ref:`input option <form-reference-date-input>`) |
19-
+----------------------+------------------------------------------------------------------------------------------------------------------------+
20-
| Rendered as | can be three select boxes or 1 or 3 text boxes, based on the `widget`_ option |
21-
+----------------------+------------------------------------------------------------------------------------------------------------------------+
22-
| Options | - `years`_ |
23-
+----------------------+------------------------------------------------------------------------------------------------------------------------+
24-
| Inherited | - `widget`_ |
25-
| options | - `input`_ |
26-
| | - `months`_ |
27-
| | - `days`_ |
28-
| | - `format`_ |
29-
| | - `data_timezone`_ |
30-
| | - `user_timezone`_ |
31-
| | - `invalid_message`_ |
32-
| | - `invalid_message_parameters`_ |
33-
| | - `virtual`_ |
34-
+----------------------+------------------------------------------------------------------------------------------------------------------------+
35-
| Parent type | :doc:`date</reference/forms/types/date>` |
36-
+----------------------+------------------------------------------------------------------------------------------------------------------------+
37-
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` |
38-
+----------------------+------------------------------------------------------------------------------------------------------------------------+
39-
40-
Field Options
41-
-------------
17+
+----------------------+-------------------------------------------------------------------------------+
18+
| Underlying Data Type | can be ``DateTime``, ``string``, ``timestamp``, or ``array`` |
19+
| | (see the :ref:`input option <form-reference-date-input>`) |
20+
+----------------------+-------------------------------------------------------------------------------+
21+
| Rendered as | can be three select boxes or 1 or 3 text boxes, based on the `widget`_ option |
22+
+----------------------+-------------------------------------------------------------------------------+
23+
| Overridden Options | - `years`_ |
24+
+----------------------+-------------------------------------------------------------------------------+
25+
| Inherited Options | - `widget`_ |
26+
| | - `input`_ |
27+
| | - `months`_ |
28+
| | - `days`_ |
29+
| | - `format`_ |
30+
| | - `pattern`_ |
31+
| | - `data_timezone`_ |
32+
| | - `user_timezone`_ |
33+
| | - `invalid_message`_ |
34+
| | - `invalid_message_parameters`_ |
35+
| | - `virtual`_ |
36+
+----------------------+-------------------------------------------------------------------------------+
37+
| Parent type | :doc:`date</reference/forms/types/date>` |
38+
+----------------------+-------------------------------------------------------------------------------+
39+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` |
40+
+----------------------+-------------------------------------------------------------------------------+
41+
42+
Overridden Options
43+
------------------
4244

4345
years
4446
~~~~~

reference/forms/types/choice.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ option.
1919
| | - `expanded`_ |
2020
| | - `preferred_choices`_ |
2121
| | - `empty_value`_ |
22-
| | - `empty_data`_ |
23-
| | - `by_reference`_ |
2422
+-------------+-----------------------------------------------------------------------------+
2523
| Inherited | - `required`_ |
2624
| options | - `label`_ |
2725
| | - `read_only`_ |
2826
| | - `error_bubbling`_ |
2927
| | - `virtual`_ |
28+
| | - `by_reference`_ |
29+
| | - `empty_data`_ |
3030
+-------------+-----------------------------------------------------------------------------+
3131
| Parent type | :doc:`form</reference/forms/types/form>` (if expanded), ``field`` otherwise |
3232
+-------------+-----------------------------------------------------------------------------+
@@ -104,10 +104,6 @@ can be created to supply the choices.
104104

105105
.. include:: /reference/forms/types/options/empty_value.rst.inc
106106

107-
.. include:: /reference/forms/types/options/empty_data.rst.inc
108-
109-
.. include:: /reference/forms/types/options/by_reference.rst.inc
110-
111107
Inherited options
112108
-----------------
113109

@@ -123,4 +119,8 @@ These options inherit from the :doc:`field</reference/forms/types/field>` type:
123119

124120
These options inherit from the :doc:`date</reference/forms/types/form>` type:
125121

126-
.. include:: /reference/forms/types/options/virtual.rst.inc
122+
.. include:: /reference/forms/types/options/virtual.rst.inc
123+
124+
.. include:: /reference/forms/types/options/by_reference.rst.inc
125+
126+
.. include:: /reference/forms/types/options/empty_data.rst.inc

reference/forms/types/country.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ you should just use the ``choice`` type directly.
2222
+-------------+-----------------------------------------------------------------------+
2323
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2424
+-------------+-----------------------------------------------------------------------+
25+
| Overriden | - `choices`_ |
26+
| Options | |
27+
+-------------+-----------------------------------------------------------------------+
2528
| Inherited | - `multiple`_ |
2629
| options | - `expanded`_ |
2730
| | - `preferred_choices`_ |
@@ -36,6 +39,18 @@ you should just use the ``choice`` type directly.
3639
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType` |
3740
+-------------+-----------------------------------------------------------------------+
3841

42+
Overriden Options
43+
-----------------
44+
45+
choices
46+
~~~~~~~
47+
48+
**default**: :method:`Symfony\\Component\\Locale\\Locale::getDisplayCountries`
49+
50+
The Country type defaults the choices option to the all locales which are
51+
returned by :method:`Symfony\\Component\\Locale\\Locale::getDisplayCountries`.
52+
It uses the default locale to determine the language.
53+
3954
Inherited options
4055
-----------------
4156

reference/forms/types/csrf.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,26 @@ The ``csrf`` type is a hidden input field containing a CSRF token.
1111
+-------------+--------------------------------------------------------------------+
1212
| Options | - ``csrf_provider`` |
1313
| | - ``intention`` |
14-
| | - ``property_path`` |
14+
+-------------+--------------------------------------------------------------------+
15+
| Overriden | - ``property_path`` |
16+
| Options | |
17+
| | |
1518
+-------------+--------------------------------------------------------------------+
1619
| Parent type | ``hidden`` |
1720
+-------------+--------------------------------------------------------------------+
1821
| Class | :class:`Symfony\\Component\\Form\\Extension\\Csrf\\Type\\CsrfType` |
1922
+-------------+--------------------------------------------------------------------+
2023

24+
Overriden Options
25+
-----------------
26+
27+
property_path
28+
~~~~~~~~~~~~~
29+
30+
**default**: ``false``
31+
32+
A Csrf field must not be mapped to the object, so this option defaults to ``false``.
33+
2134
Field Options
2235
-------------
2336

@@ -36,4 +49,4 @@ intention
3649

3750
An optional unique identifier used to generate the CSRF token.
3851

39-
.. include:: /reference/forms/types/options/property_path.rst.inc
52+
.. include:: /reference/forms/types/options/property_path.rst.inc

reference/forms/types/date.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ day, and year) or three select boxes (see the `widget_` option).
2929
| | - `data_timezone`_ |
3030
| | - `user_timezone`_ |
3131
+----------------------+-----------------------------------------------------------------------------+
32+
| Overriden Options | - `by_reference`_ |
33+
| | - `error_bubbling`_ |
34+
+----------------------+-----------------------------------------------------------------------------+
3235
| Inherited | - `invalid_message`_ |
3336
| options | - `invalid_message_parameters`_ |
3437
| | - `virtual`_ |
@@ -111,6 +114,21 @@ Alternatively, you can specify a string to be displayed for the "blank" value::
111114

112115
.. include:: /reference/forms/types/options/user_timezone.rst.inc
113116

117+
Overridden Options
118+
------------------
119+
120+
by_reference
121+
~~~~~~~~~~~~
122+
123+
**default**: ``false``
124+
125+
The ``DateTime`` classes are treated as immutable objects.
126+
127+
error_bubbling
128+
~~~~~~~~~~~~~~
129+
130+
**default**: ``false``
131+
114132
Inherited options
115133
-----------------
116134

reference/forms/types/entity.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ objects from the database.
1717
| | - `query_builder`_ |
1818
| | - `em`_ |
1919
+-------------+------------------------------------------------------------------+
20+
| Overriden | - `choices` |
21+
| Options | - `choice_list` |
22+
+-------------+------------------------------------------------------------------+
2023
| Inherited | - `required`_ |
2124
| options | - `label`_ |
2225
| | - `multiple`_ |
@@ -108,6 +111,22 @@ em
108111
If specified, the specified entity manager will be used to load the choices
109112
instead of the default entity manager.
110113

114+
Overriden Options
115+
-----------------
116+
117+
choices
118+
~~~~~~~
119+
120+
**default**: ``null``
121+
122+
choice_list
123+
~~~~~~~~~~~
124+
125+
**default**: all entities selected
126+
127+
The choices will default to all entities selected with one of the options that
128+
are documented above.
129+
111130
Inherited options
112131
-----------------
113132

reference/forms/types/form.rst

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,28 @@
44
form Field Type
55
===============
66

7-
See :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType`.
7+
See :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType`.
8+
9+
Overriden Options
10+
-----------------
11+
12+
empty_data
13+
~~~~~~~~~~
14+
15+
**default**: ``array()`` / ``new $data_class()``
16+
17+
When no ``data_class`` option is specified, it will return an empty array.
18+
Otherwise, it will default to a new instance of the class defined in
19+
``data_class``.
20+
21+
virtual
22+
~~~~~~~
23+
24+
**default**: ``false``
25+
26+
error_bubbling
27+
~~~~~~~~~~~~~~
28+
29+
**default**: ``true``
30+
31+
Errors of the form bubbles to the root form by default.

reference/forms/types/hidden.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,34 @@ The hidden type represents a hidden input field.
99
+-------------+----------------------------------------------------------------------+
1010
| Rendered as | ``input`` ``hidden`` field |
1111
+-------------+----------------------------------------------------------------------+
12-
| Inherited | - ``data`` |
13-
| options | - ``property_path`` |
12+
| Overriden | - `required`_ |
13+
| Options | - `error_bubbling`_ |
14+
+-------------+----------------------------------------------------------------------+
15+
| Inherited | - `data`_ |
16+
| options | - `property_path`_ |
1417
+-------------+----------------------------------------------------------------------+
1518
| Parent type | :doc:`field</reference/forms/types/field>` |
1619
+-------------+----------------------------------------------------------------------+
1720
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType` |
1821
+-------------+----------------------------------------------------------------------+
1922

23+
Overriden Options
24+
-----------------
25+
26+
required
27+
~~~~~~~~
28+
29+
**default**: ``false``
30+
31+
Hidden fields cannot have a required attribute.
32+
33+
error_bubbling
34+
~~~~~~~~~~~~~~
35+
36+
**default**: ``true``
37+
38+
Pass errors to the root form, otherwise they will not be visible.
39+
2040
Inherited Options
2141
-----------------
2242

reference/forms/types/language.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ you should just use the ``choice`` type directly.
2323
+-------------+------------------------------------------------------------------------+
2424
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2525
+-------------+------------------------------------------------------------------------+
26+
| Overriden | - `choices`_ |
27+
| Options | |
28+
+-------------+------------------------------------------------------------------------+
2629
| Inherited | - `multiple`_ |
2730
| options | - `expanded`_ |
2831
| | - `preferred_choices`_ |
@@ -37,6 +40,18 @@ you should just use the ``choice`` type directly.
3740
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType` |
3841
+-------------+------------------------------------------------------------------------+
3942

43+
Overriden Options
44+
-----------------
45+
46+
choices
47+
~~~~~~~
48+
49+
**default**: :method:`Symfony\\Component\\Locale\\Locale::getDisplayLanguages`
50+
51+
The choices option defaults to all languages returned by
52+
:method:`Symfony\\Component\\Locale\\Locale::getDisplayLanguages`. It uses the
53+
default locale to specify the language.
54+
4055
Inherited Options
4156
-----------------
4257

reference/forms/types/locale.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ you should just use the ``choice`` type directly.
2424
+-------------+------------------------------------------------------------------------+
2525
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2626
+-------------+------------------------------------------------------------------------+
27+
| Overriden | - `choices`_ |
28+
| Options | |
29+
+-------------+------------------------------------------------------------------------+
2730
| Inherited | - `multiple`_ |
2831
| options | - `expanded`_ |
2932
| | - `preferred_choices`_ |
@@ -38,6 +41,19 @@ you should just use the ``choice`` type directly.
3841
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType` |
3942
+-------------+------------------------------------------------------------------------+
4043

44+
Overriden Options
45+
-----------------
46+
47+
choices
48+
~~~~~~~
49+
50+
**default**: :method:`Symfony\\Component\\Locale\\Locale::getDisplayLocales`
51+
52+
The choices option defaults to all locales returned by
53+
:method:`Symfony\\Component\\Locale\\Locale::getDisplayLocales`. It uses the
54+
default locale to specify the language.
55+
56+
4157
Inherited options
4258
-----------------
4359

0 commit comments

Comments
 (0)