Skip to content

Documented the new date_label and time_label options #10389

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

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions reference/forms/types/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
+----------------------+-----------------------------------------------------------------------------+
| Options | - `choice_translation_domain`_ |
| | - `date_format`_ |
| | - `date_label`_ |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should sort the options IMO

| | - `date_widget`_ |
| | - `days`_ |
| | - `placeholder`_ |
Expand All @@ -28,6 +29,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
| | - `model_timezone`_ |
| | - `months`_ |
| | - `seconds`_ |
| | - `time_label`_ |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we need to change the order below then too

| | - `time_widget`_ |
| | - `view_timezone`_ |
| | - `widget`_ |
Expand Down Expand Up @@ -72,6 +74,23 @@ date_widget

.. include:: /reference/forms/types/options/date_widget_description.rst.inc

date_label
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we need to move this up :)

~~~~~~~~~~

**type**: ``string`` | ``null`` **default**: The label is "guessed" from the field name

.. versionadded:: 4.2
The ``date_label`` option was introduced in Symfony 4.2.

Sets the label that will be used when rendering the date widget. Setting it to
``false`` will suppress the label::

use Symfony\Component\Form\Extension\Core\Type\DateTimeType;

$builder->add('startDateTime', DateTimeType::class, array(
'date_label' => 'Starts On',
));

.. include:: /reference/forms/types/options/days.rst.inc

placeholder
Expand Down Expand Up @@ -151,6 +170,23 @@ time_widget

Defines the ``widget`` option for the :doc:`TimeType </reference/forms/types/time>`.

time_label
~~~~~~~~~~

**type**: ``string`` | ``null`` **default**: The label is "guessed" from the field name

.. versionadded:: 4.2
The ``time_label`` option was introduced in Symfony 4.2.

Sets the label that will be used when rendering the time widget. Setting it to
``false`` will suppress the label::

use Symfony\Component\Form\Extension\Core\Type\DateTimeType;

$builder->add('startDateTime', DateTimeType::class, array(
'time_label' => 'Starts On',
));

.. include:: /reference/forms/types/options/view_timezone.rst.inc

widget
Expand Down