-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Documented the overridden form options #5313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
8d360d9
e66ec5c
a8ad338
7ce8191
618e11d
8e825d9
e41b3cc
f44e971
48b402b
7f8e09a
1dc53fa
32c0af1
974dfef
eb20dc8
0a5781b
e14b650
2b63f24
62a11d5
596a0bc
84633db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,12 @@ The ``file`` type represents a file input in your form. | |
+-------------+---------------------------------------------------------------------+ | ||
| Rendered as | ``input`` ``file`` field | | ||
+-------------+---------------------------------------------------------------------+ | ||
| Overridden | - `compound`_ | | ||
| options | - `data_class`_ | | ||
| | - `empty_data`_ | | ||
+-------------+---------------------------------------------------------------------+ | ||
| Inherited | - `disabled`_ | | ||
| options | - `empty_data`_ | | ||
| | - `error_bubbling`_ | | ||
| options | - `error_bubbling`_ | | ||
| | - `error_mapping`_ | | ||
| | - `label`_ | | ||
| | - `label_attr`_ | | ||
|
@@ -24,6 +27,26 @@ The ``file`` type represents a file input in your form. | |
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType` | | ||
+-------------+---------------------------------------------------------------------+ | ||
|
||
Overridden Options | ||
------------------ | ||
|
||
.. include:: /reference/forms/types/options/compound_type.rst.inc | ||
|
||
data_class | ||
~~~~~~~~~~ | ||
|
||
**type**: ``string`` **default**: :class:`Symfony\\Component\\HttpFoundation\\File\\File` | ||
|
||
This option sets the appropriate file-realted data mapper to be used by the type. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. related There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! Thanks. |
||
|
||
empty_data | ||
~~~~~~~~~~ | ||
|
||
**type**: ``mixed`` **default**: ``null`` | ||
|
||
This option determines what value the field will return when the submitted | ||
value is empty. | ||
|
||
Basic Usage | ||
----------- | ||
|
||
|
@@ -82,14 +105,6 @@ type: | |
|
||
.. include:: /reference/forms/types/options/disabled.rst.inc | ||
|
||
.. include:: /reference/forms/types/options/empty_data.rst.inc | ||
:end-before: DEFAULT_PLACEHOLDER | ||
|
||
The default value is ``null``. | ||
|
||
.. include:: /reference/forms/types/options/empty_data.rst.inc | ||
:start-after: DEFAULT_PLACEHOLDER | ||
|
||
.. include:: /reference/forms/types/options/error_bubbling.rst.inc | ||
|
||
.. include:: /reference/forms/types/options/error_mapping.rst.inc | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
compound | ||
~~~~~~~~ | ||
|
||
**type**: ``boolean`` **default**: ``false`` | ||
|
||
This option specifies whether the type contains child types or not. This option | ||
is managed internally for built-in types, so there is no need to configure | ||
it explicitly. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
data_class | ||
~~~~~~~~~~ | ||
|
||
**type**: ``string`` **default**: ``null`` | ||
|
||
The internal normalized representation of this type is an array, not a ``\DateTime`` | ||
object. Therefore, the ``data_class`` option is initialized to ``null`` to avoid | ||
the ``FormType`` object from initializing it to ``\DateTime``. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,9 @@ The ``password`` field renders an input password text box. | |
+-------------+------------------------------------------------------------------------+ | ||
| Options | - `always_empty`_ | | ||
+-------------+------------------------------------------------------------------------+ | ||
| Overridden | - `trim`_ | | ||
| options | | | ||
+-------------+------------------------------------------------------------------------+ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be moved below "Options" (same for their descriptions) |
||
| Inherited | - `disabled`_ | | ||
| options | - `empty_data`_ | | ||
| | - `error_bubbling`_ | | ||
|
@@ -21,7 +24,6 @@ The ``password`` field renders an input password text box. | |
| | - `max_length`_ | | ||
| | - `read_only`_ | | ||
| | - `required`_ | | ||
| | - `trim`_ | | ||
+-------------+------------------------------------------------------------------------+ | ||
| Parent type | :doc:`text </reference/forms/types/text>` | | ||
+-------------+------------------------------------------------------------------------+ | ||
|
@@ -44,6 +46,18 @@ Put simply, if for some reason you want to render your password field | |
*with* the password value already entered into the box, set this to false | ||
and submit the form. | ||
|
||
Overridden Options | ||
------------------ | ||
|
||
trim | ||
~~~~ | ||
|
||
**type**: ``boolean`` **default**: ``false`` | ||
|
||
Unlike the rest of form types, the ``password`` type doesn't apply the | ||
:phpfunction:`trim` function to the value submitted by the user. This ensures that | ||
the password is merged back onto the underlying object exactly as it was typed | ||
by the user. | ||
|
||
Inherited Options | ||
----------------- | ||
|
@@ -76,13 +90,3 @@ The default value is ``''`` (the empty string). | |
.. include:: /reference/forms/types/options/read_only.rst.inc | ||
|
||
.. include:: /reference/forms/types/options/required.rst.inc | ||
|
||
trim | ||
~~~~ | ||
|
||
**type**: ``boolean`` **default**: ``false`` | ||
|
||
If true, the whitespace of the submitted string value will be stripped | ||
via the :phpfunction:`trim` function when the data is bound. This guarantees | ||
that if a value is submitted with extra whitespace, it will be removed before | ||
the value is merged back onto the underlying object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be reverted (see #5343).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.