Skip to content

Commit a7c30bb

Browse files
committed
minor #10389 Documented the new date_label and time_label options (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #10389). Discussion ---------- Documented the new date_label and time_label options Fixes #10292. Commits ------- eee1eaa Documented the new date_label and time_label options
2 parents a3db105 + eee1eaa commit a7c30bb

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

reference/forms/types/datetime.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
1717
+----------------------+-----------------------------------------------------------------------------+
1818
| Options | - `choice_translation_domain`_ |
1919
| | - `date_format`_ |
20+
| | - `date_label`_ |
2021
| | - `date_widget`_ |
2122
| | - `days`_ |
2223
| | - `placeholder`_ |
@@ -28,6 +29,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
2829
| | - `model_timezone`_ |
2930
| | - `months`_ |
3031
| | - `seconds`_ |
32+
| | - `time_label`_ |
3133
| | - `time_widget`_ |
3234
| | - `view_timezone`_ |
3335
| | - `widget`_ |
@@ -67,6 +69,23 @@ Defines the ``format`` option that will be passed down to the date field.
6769
See the :ref:`DateType's format option <reference-forms-type-date-format>`
6870
for more details.
6971

72+
date_label
73+
~~~~~~~~~~
74+
75+
**type**: ``string`` | ``null`` **default**: The label is "guessed" from the field name
76+
77+
.. versionadded:: 4.2
78+
The ``date_label`` option was introduced in Symfony 4.2.
79+
80+
Sets the label that will be used when rendering the date widget. Setting it to
81+
``false`` will suppress the label::
82+
83+
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
84+
85+
$builder->add('startDateTime', DateTimeType::class, array(
86+
'date_label' => 'Starts On',
87+
));
88+
7089
date_widget
7190
~~~~~~~~~~~
7291

@@ -144,6 +163,23 @@ this format.
144163

145164
.. include:: /reference/forms/types/options/seconds.rst.inc
146165

166+
time_label
167+
~~~~~~~~~~
168+
169+
**type**: ``string`` | ``null`` **default**: The label is "guessed" from the field name
170+
171+
.. versionadded:: 4.2
172+
The ``time_label`` option was introduced in Symfony 4.2.
173+
174+
Sets the label that will be used when rendering the time widget. Setting it to
175+
``false`` will suppress the label::
176+
177+
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
178+
179+
$builder->add('startDateTime', DateTimeType::class, array(
180+
'time_label' => 'Starts On',
181+
));
182+
147183
time_widget
148184
~~~~~~~~~~~
149185

0 commit comments

Comments
 (0)