Skip to content

Commit 21c7666

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: (26 commits) moving options below basic usage changing a few orders of sections - mostly to move overridden after the main options Rewrite note a bit fix capitalization [Cookbook][Assetic] complete a sentence Fixed a typo Reordered two overridden options Added missing types in overridden options Fixed the order of the different options Fixed the order of the different options Improved the explanation about the "compoun" option Fixer minor issues Fixed errors noticed by Wouter Removed a duplicated "trim" option in the "password" type Removed again a duplicated option explanation Removed a duplicated option explanation in "file" type Extracted the common "data_class" option explanation for data-related types Documented the overridden options of "date" type Documented overridden options for "file" type Documented the overridden options of the "password" type ...
2 parents e2fd204 + 2f64d2b commit 21c7666

23 files changed

+155
-35
lines changed

cookbook/assetic/php.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ formatter used by the filter to produce the compiled CSS file. Using the
116116
compressed formatter will minimize the the resulting file, regardless of whether
117117
the original files are regular CSS files or SCSS files.
118118

119-
Next, your Twig template to add the ``{% stylesheets %}`` tag defined by Assetic:
119+
Next, update your Twig template to add the ``{% stylesheets %}`` tag defined
120+
by Assetic:
120121

121122
.. code-block:: html+jinja
122123

cookbook/form/form_customization.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ fragment needed to render every part of a form:
114114
but the CSS classes applied are the ones used to display the forms horizontally
115115
(i.e. the label and the widget in the same row).
116116

117+
.. caution::
118+
119+
When you use the Bootstrap form themes and render the fields manually,
120+
calling ``form_label()`` for a checkbox/radio field doesn't show anything.
121+
Due to Bootstrap internals, the label is already shown by ``form_widget()``.
122+
117123
In the next section you will learn how to customize a theme by overriding
118124
some or all of its fragments.
119125

cookbook/security/form_login_setup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ firewall matches *all* URLs, including ``/login_check``). If ``/login_check``
456456
doesn't match any firewall, you'll receive a ``Unable to find the controller
457457
for path "/login_check"`` exception.
458458

459-
4. Multiple Firewalls Don't Share the same Security Context
459+
4. Multiple Firewalls Don't Share the Same Security Context
460460
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
461461

462462
If you're using multiple firewalls and you authenticate against one firewall,

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
@@ -30,7 +30,9 @@ day and year) or three select boxes (see the `widget`_ option).
3030
| | - `widget`_ |
3131
| | - `years`_ |
3232
+----------------------+-----------------------------------------------------------------------------+
33-
| Overridden Options | - `by_reference`_ |
33+
| Overridden options | - `by_reference`_ |
34+
| | - `compound`_ |
35+
| | - `data_class`_ |
3436
| | - `error_bubbling`_ |
3537
+----------------------+-----------------------------------------------------------------------------+
3638
| Inherited | - `data`_ |
@@ -132,6 +134,10 @@ by_reference
132134

133135
The ``DateTime`` classes are treated as immutable objects.
134136

137+
.. include:: /reference/forms/types/options/compound_type.rst.inc
138+
139+
.. include:: /reference/forms/types/options/data_class_date.rst.inc
140+
135141
error_bubbling
136142
~~~~~~~~~~~~~~
137143

reference/forms/types/datetime.rst

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

135140
.. include:: /reference/forms/types/options/years.rst.inc
136141

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

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
@@ -11,9 +11,12 @@ The ``file`` type represents a file input in your form.
1111
+-------------+---------------------------------------------------------------------+
1212
| Options | - `multiple`_ |
1313
+-------------+---------------------------------------------------------------------+
14+
| Overridden | - `compound`_ |
15+
| options | - `data_class`_ |
16+
| | - `empty_data`_ |
17+
+-------------+---------------------------------------------------------------------+
1418
| Inherited | - `disabled`_ |
15-
| options | - `empty_data`_ |
16-
| | - `error_bubbling`_ |
19+
| options | - `error_bubbling`_ |
1720
| | - `error_mapping`_ |
1821
| | - `label`_ |
1922
| | - `label_attr`_ |
@@ -86,6 +89,26 @@ multiple
8689

8790
When set to true, the user will be able to upload multiple files at the same time.
8891

92+
Overridden Options
93+
------------------
94+
95+
.. include:: /reference/forms/types/options/compound_type.rst.inc
96+
97+
data_class
98+
~~~~~~~~~~
99+
100+
**type**: ``string`` **default**: :class:`Symfony\\Component\\HttpFoundation\\File\\File`
101+
102+
This option sets the appropriate file-related data mapper to be used by the type.
103+
104+
empty_data
105+
~~~~~~~~~~
106+
107+
**type**: ``mixed`` **default**: ``null``
108+
109+
This option determines what value the field will return when the submitted
110+
value is empty.
111+
89112
Inherited Options
90113
-----------------
91114

@@ -94,14 +117,6 @@ type:
94117

95118
.. include:: /reference/forms/types/options/disabled.rst.inc
96119

97-
.. include:: /reference/forms/types/options/empty_data.rst.inc
98-
:end-before: DEFAULT_PLACEHOLDER
99-
100-
The default value is ``null``.
101-
102-
.. include:: /reference/forms/types/options/empty_data.rst.inc
103-
:start-after: DEFAULT_PLACEHOLDER
104-
105120
.. include:: /reference/forms/types/options/error_bubbling.rst.inc
106121

107122
.. 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
@@ -20,6 +20,9 @@ integers. By default, all non-integer values (e.g. 6.78) will round down
2020
| | - `scale`_ |
2121
| | - `rounding_mode`_ |
2222
+-------------+-----------------------------------------------------------------------+
23+
| Overridden | - `compound`_ |
24+
| options | |
25+
+-------------+-----------------------------------------------------------------------+
2326
| Inherited | - `data`_ |
2427
| options | - `disabled`_ |
2528
| | - `empty_data`_ |
@@ -74,6 +77,11 @@ on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\Integ
7477
* ``IntegerToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the
7578
"nearest neighbor". If both neighbors are equidistant, round up.
7679

80+
Overridden Options
81+
------------------
82+
83+
.. include:: /reference/forms/types/options/compound_type.rst.inc
84+
7785
Inherited Options
7886
-----------------
7987

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
@@ -19,6 +19,9 @@ how the input and output of the data is handled.
1919
| | - `grouping`_ |
2020
| | - `scale`_ |
2121
+-------------+---------------------------------------------------------------------+
22+
| Overridden | - `compound`_ |
23+
| options | |
24+
+-------------+---------------------------------------------------------------------+
2225
| Inherited | - `data`_ |
2326
| options | - `disabled`_ |
2427
| | - `empty_data`_ |
@@ -87,6 +90,11 @@ you can modify this value. You probably won't need to do this unless,
8790
for example, you want to round to the nearest dollar (set the scale
8891
to ``0``).
8992

93+
Overridden Options
94+
------------------
95+
96+
.. include:: /reference/forms/types/options/compound_type.rst.inc
97+
9098
Inherited Options
9199
-----------------
92100

reference/forms/types/number.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ that you want to use for your number.
1515
| | - `scale`_ |
1616
| | - `rounding_mode`_ |
1717
+-------------+----------------------------------------------------------------------+
18+
| Overridden | - `compound`_ |
19+
| options | |
20+
+-------------+----------------------------------------------------------------------+
1821
| Inherited | - `data`_ |
1922
| options | - `disabled`_ |
2023
| | - `empty_data`_ |
@@ -69,6 +72,11 @@ option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\D
6972
* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the
7073
"nearest neighbor". If both neighbors are equidistant, round up.
7174

75+
Overridden Options
76+
------------------
77+
78+
.. include:: /reference/forms/types/options/compound_type.rst.inc
79+
7280
Inherited Options
7381
-----------------
7482

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`_ (deprecated as of 2.5) |
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
@@ -18,6 +18,9 @@ This field adds a percentage sign "``%``" after the input box.
1818
| Options | - `scale`_ |
1919
| | - `type`_ |
2020
+-------------+-----------------------------------------------------------------------+
21+
| Overridden | - `compound`_ |
22+
| options | |
23+
+-------------+-----------------------------------------------------------------------+
2124
| Inherited | - `data`_ |
2225
| options | - `disabled`_ |
2326
| | - `empty_data`_ |
@@ -71,6 +74,11 @@ object. The two "types" handle these two cases:
7174
The raw value (``55``) is shown to the user and stored on your object.
7275
Note that this only works for integer values.
7376

77+
Overridden Options
78+
------------------
79+
80+
.. include:: /reference/forms/types/options/compound_type.rst.inc
81+
7482
Inherited Options
7583
-----------------
7684

0 commit comments

Comments
 (0)