Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd8f49b

Browse files
committed
feature #5313 Documented the overridden form options (javiereguiluz)
This PR was merged into the 2.3 branch. Discussion ---------- Documented the overridden form options | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | all | Fixed tickets | #3412 Commits ------- 84633db Fixed a typo 596a0bc Reordered two overridden options 62a11d5 Added missing types in overridden options 2b63f24 Fixed the order of the different options e14b650 Fixed the order of the different options 0a5781b Improved the explanation about the "compoun" option eb20dc8 Fixer minor issues 974dfef Fixed errors noticed by Wouter 32c0af1 Removed a duplicated "trim" option in the "password" type 1dc53fa Removed again a duplicated option explanation 7f8e09a Removed a duplicated option explanation in "file" type 48b402b Extracted the common "data_class" option explanation for data-related types f44e971 Documented the overridden options of "date" type e41b3cc Documented overridden options for "file" type 8e825d9 Documented the overridden options of the "password" type 618e11d Documented the overridden options for "time" type 7ce8191 Documented overridden options for hidden field a8ad338 Documented overriden options for numeric types e66ec5c Created a compound_type file because this option is shared with lots of types 8d360d9 Documented the Overridden Options of the Text type
2 parents 314da54 + 84633db commit cd8f49b

20 files changed

+145
-32
lines changed

reference/forms/types/country.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ you should just use the ``choice`` type directly.
2323
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2424
+-------------+-----------------------------------------------------------------------+
2525
| Overridden | - `choices`_ |
26-
| Options | |
26+
| options | |
2727
+-------------+-----------------------------------------------------------------------+
2828
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type |
2929
| options | |

reference/forms/types/currency.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ you should just use the ``choice`` type directly.
1717
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
1818
+-------------+------------------------------------------------------------------------+
1919
| Overridden | - `choices`_ |
20-
| Options | |
20+
| options | |
2121
+-------------+------------------------------------------------------------------------+
2222
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type |
2323
| options | |

reference/forms/types/date.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ day and year) or three select boxes (see the `widget`_ option).
2929
| | - `widget`_ |
3030
| | - `years`_ |
3131
+----------------------+-----------------------------------------------------------------------------+
32-
| Overridden Options | - `by_reference`_ |
32+
| Overridden options | - `by_reference`_ |
33+
| | - `compound`_ |
34+
| | - `data_class`_ |
3335
| | - `error_bubbling`_ |
3436
+----------------------+-----------------------------------------------------------------------------+
3537
| Inherited | - `data`_ |
@@ -125,6 +127,10 @@ by_reference
125127

126128
The ``DateTime`` classes are treated as immutable objects.
127129

130+
.. include:: /reference/forms/types/options/compound_type.rst.inc
131+
132+
.. include:: /reference/forms/types/options/data_class_date.rst.inc
133+
128134
error_bubbling
129135
~~~~~~~~~~~~~~
130136

reference/forms/types/datetime.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
3333
| | - `with_seconds`_ |
3434
| | - `years`_ |
3535
+----------------------+-----------------------------------------------------------------------------+
36+
| Overridden options | - `by_reference`_ |
37+
| | - `compound`_ |
38+
| | - `data_class`_ |
39+
| | - `error_bubbling`_ |
40+
+----------------------+-----------------------------------------------------------------------------+
3641
| Inherited | - `data`_ |
3742
| options | - `disabled`_ |
3843
| | - `inherit_data`_ |
@@ -131,6 +136,25 @@ with the `date_widget`_ and `time_widget`_ options.
131136

132137
.. include:: /reference/forms/types/options/years.rst.inc
133138

139+
Overridden Options
140+
------------------
141+
142+
by_reference
143+
~~~~~~~~~~~~
144+
145+
**default**: ``false``
146+
147+
The ``DateTime`` classes are treated as immutable objects.
148+
149+
.. include:: /reference/forms/types/options/compound_type.rst.inc
150+
151+
.. include:: /reference/forms/types/options/data_class_date.rst.inc
152+
153+
error_bubbling
154+
~~~~~~~~~~~~~~
155+
156+
**default**: ``false``
157+
134158
Inherited Options
135159
-----------------
136160

reference/forms/types/entity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ objects from the database.
1919
| | - `property`_ |
2020
| | - `query_builder`_ |
2121
+-------------+------------------------------------------------------------------+
22-
| Overriden | - `choice_list`_ |
22+
| Overridden | - `choice_list`_ |
2323
| options | - `choices`_ |
2424
+-------------+------------------------------------------------------------------+
2525
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type: |

reference/forms/types/file.rst

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ The ``file`` type represents a file input in your form.
99
+-------------+---------------------------------------------------------------------+
1010
| Rendered as | ``input`` ``file`` field |
1111
+-------------+---------------------------------------------------------------------+
12+
| Overridden | - `compound`_ |
13+
| options | - `data_class`_ |
14+
| | - `empty_data`_ |
15+
+-------------+---------------------------------------------------------------------+
1216
| Inherited | - `disabled`_ |
13-
| options | - `empty_data`_ |
14-
| | - `error_bubbling`_ |
17+
| options | - `error_bubbling`_ |
1518
| | - `error_mapping`_ |
1619
| | - `label`_ |
1720
| | - `label_attr`_ |
@@ -24,6 +27,26 @@ The ``file`` type represents a file input in your form.
2427
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType` |
2528
+-------------+---------------------------------------------------------------------+
2629

30+
Overridden Options
31+
------------------
32+
33+
.. include:: /reference/forms/types/options/compound_type.rst.inc
34+
35+
data_class
36+
~~~~~~~~~~
37+
38+
**type**: ``string`` **default**: :class:`Symfony\\Component\\HttpFoundation\\File\\File`
39+
40+
This option sets the appropriate file-related data mapper to be used by the type.
41+
42+
empty_data
43+
~~~~~~~~~~
44+
45+
**type**: ``mixed`` **default**: ``null``
46+
47+
This option determines what value the field will return when the submitted
48+
value is empty.
49+
2750
Basic Usage
2851
-----------
2952

@@ -82,14 +105,6 @@ type:
82105

83106
.. include:: /reference/forms/types/options/disabled.rst.inc
84107

85-
.. include:: /reference/forms/types/options/empty_data.rst.inc
86-
:end-before: DEFAULT_PLACEHOLDER
87-
88-
The default value is ``null``.
89-
90-
.. include:: /reference/forms/types/options/empty_data.rst.inc
91-
:start-after: DEFAULT_PLACEHOLDER
92-
93108
.. include:: /reference/forms/types/options/error_bubbling.rst.inc
94109

95110
.. include:: /reference/forms/types/options/error_mapping.rst.inc

reference/forms/types/hidden.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ The hidden type represents a hidden input field.
99
+-------------+----------------------------------------------------------------------+
1010
| Rendered as | ``input`` ``hidden`` field |
1111
+-------------+----------------------------------------------------------------------+
12-
| Overriden | - `error_bubbling`_ |
13-
| options | - `required`_ |
12+
| Overriden | - `compound`_ |
13+
| options | - `error_bubbling`_ |
14+
| | - `required`_ |
1415
+-------------+----------------------------------------------------------------------+
1516
| Inherited | - `data`_ |
1617
| options | - `error_mapping`_ |
@@ -25,6 +26,8 @@ The hidden type represents a hidden input field.
2526
Overridden Options
2627
------------------
2728

29+
.. include:: /reference/forms/types/options/compound_type.rst.inc
30+
2831
error_bubbling
2932
~~~~~~~~~~~~~~
3033

reference/forms/types/integer.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ integers. By default, all non-integer values (e.g. 6.78) will round down
1616
+-------------+-----------------------------------------------------------------------+
1717
| Rendered as | ``input`` ``number`` field |
1818
+-------------+-----------------------------------------------------------------------+
19+
| Overridden | - `compound`_ |
20+
| options | |
21+
+-------------+-----------------------------------------------------------------------+
1922
| Options | - `grouping`_ |
2023
| | - `precision`_ |
2124
| | - `rounding_mode`_ |
@@ -38,6 +41,11 @@ integers. By default, all non-integer values (e.g. 6.78) will round down
3841
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType` |
3942
+-------------+-----------------------------------------------------------------------+
4043

44+
Overridden Options
45+
------------------
46+
47+
.. include:: /reference/forms/types/options/compound_type.rst.inc
48+
4149
Field Options
4250
-------------
4351

reference/forms/types/language.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ you should just use the ``choice`` type directly.
2424
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2525
+-------------+------------------------------------------------------------------------+
2626
| Overridden | - `choices`_ |
27-
| Options | |
27+
| options | |
2828
+-------------+------------------------------------------------------------------------+
2929
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type |
3030
| options | |

reference/forms/types/locale.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ you should just use the ``choice`` type directly.
2626
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2727
+-------------+------------------------------------------------------------------------+
2828
| Overridden | - `choices`_ |
29-
| Options | |
29+
| options | |
3030
+-------------+------------------------------------------------------------------------+
3131
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type |
3232
| options | |

reference/forms/types/money.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ how the input and output of the data is handled.
1414
+-------------+---------------------------------------------------------------------+
1515
| Rendered as | ``input`` ``text`` field |
1616
+-------------+---------------------------------------------------------------------+
17+
| Overridden | - `compound`_ |
18+
| options | |
19+
+-------------+---------------------------------------------------------------------+
1720
| Options | - `currency`_ |
1821
| | - `divisor`_ |
1922
| | - `grouping`_ |
@@ -37,6 +40,11 @@ how the input and output of the data is handled.
3740
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType` |
3841
+-------------+---------------------------------------------------------------------+
3942

43+
Overridden Options
44+
------------------
45+
46+
.. include:: /reference/forms/types/options/compound_type.rst.inc
47+
4048
Field Options
4149
-------------
4250

reference/forms/types/number.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ that you want to use for your number.
1111
+-------------+----------------------------------------------------------------------+
1212
| Rendered as | ``input`` ``text`` field |
1313
+-------------+----------------------------------------------------------------------+
14+
| Overridden | - `compound`_ |
15+
| options | |
16+
+-------------+----------------------------------------------------------------------+
1417
| Options | - `grouping`_ |
1518
| | - `precision`_ |
1619
| | - `rounding_mode`_ |
@@ -33,6 +36,11 @@ that you want to use for your number.
3336
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType` |
3437
+-------------+----------------------------------------------------------------------+
3538

39+
Overridden Options
40+
------------------
41+
42+
.. include:: /reference/forms/types/options/compound_type.rst.inc
43+
3644
Field Options
3745
-------------
3846

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
compound
2+
~~~~~~~~
3+
4+
**type**: ``boolean`` **default**: ``false``
5+
6+
This option specifies whether the type contains child types or not. This option
7+
is managed internally for built-in types, so there is no need to configure
8+
it explicitly.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
data_class
2+
~~~~~~~~~~
3+
4+
**type**: ``string`` **default**: ``null``
5+
6+
The internal normalized representation of this type is an array, not a ``\DateTime``
7+
object. Therefore, the ``data_class`` option is initialized to ``null`` to avoid
8+
the ``FormType`` object from initializing it to ``\DateTime``.

reference/forms/types/password.rst

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ The ``password`` field renders an input password text box.
1111
+-------------+------------------------------------------------------------------------+
1212
| Options | - `always_empty`_ |
1313
+-------------+------------------------------------------------------------------------+
14+
| Overridden | - `trim`_ |
15+
| options | |
16+
+-------------+------------------------------------------------------------------------+
1417
| Inherited | - `disabled`_ |
1518
| options | - `empty_data`_ |
1619
| | - `error_bubbling`_ |
@@ -21,7 +24,6 @@ The ``password`` field renders an input password text box.
2124
| | - `max_length`_ |
2225
| | - `read_only`_ |
2326
| | - `required`_ |
24-
| | - `trim`_ |
2527
+-------------+------------------------------------------------------------------------+
2628
| Parent type | :doc:`text </reference/forms/types/text>` |
2729
+-------------+------------------------------------------------------------------------+
@@ -44,6 +46,18 @@ Put simply, if for some reason you want to render your password field
4446
*with* the password value already entered into the box, set this to false
4547
and submit the form.
4648

49+
Overridden Options
50+
------------------
51+
52+
trim
53+
~~~~
54+
55+
**type**: ``boolean`` **default**: ``false``
56+
57+
Unlike the rest of form types, the ``password`` type doesn't apply the
58+
:phpfunction:`trim` function to the value submitted by the user. This ensures that
59+
the password is merged back onto the underlying object exactly as it was typed
60+
by the user.
4761

4862
Inherited Options
4963
-----------------
@@ -76,13 +90,3 @@ The default value is ``''`` (the empty string).
7690
.. include:: /reference/forms/types/options/read_only.rst.inc
7791

7892
.. include:: /reference/forms/types/options/required.rst.inc
79-
80-
trim
81-
~~~~
82-
83-
**type**: ``boolean`` **default**: ``false``
84-
85-
If true, the whitespace of the submitted string value will be stripped
86-
via the :phpfunction:`trim` function when the data is bound. This guarantees
87-
that if a value is submitted with extra whitespace, it will be removed before
88-
the value is merged back onto the underlying object.

reference/forms/types/percent.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ This field adds a percentage sign "``%``" after the input box.
1515
+-------------+-----------------------------------------------------------------------+
1616
| Rendered as | ``input`` ``text`` field |
1717
+-------------+-----------------------------------------------------------------------+
18+
| Overridden | - `compound`_ |
19+
| options | |
20+
+-------------+-----------------------------------------------------------------------+
1821
| Options | - `precision`_ |
1922
| | - `type`_ |
2023
+-------------+-----------------------------------------------------------------------+
@@ -36,6 +39,11 @@ This field adds a percentage sign "``%``" after the input box.
3639
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType` |
3740
+-------------+-----------------------------------------------------------------------+
3841

42+
Overridden Options
43+
------------------
44+
45+
.. include:: /reference/forms/types/options/compound_type.rst.inc
46+
3947
Field Options
4048
-------------
4149

reference/forms/types/repeated.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ accuracy.
2020
| | - `type`_ |
2121
+-------------+------------------------------------------------------------------------+
2222
| Overridden | - `error_bubbling`_ |
23-
| Options | |
23+
| options | |
2424
+-------------+------------------------------------------------------------------------+
2525
| Inherited | - `data`_ |
2626
| options | - `error_mapping`_ |

0 commit comments

Comments
 (0)