Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] Documented the intl option in TimezoneType #11867

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

Merged
merged 1 commit into from
Jul 3, 2019
Merged
Changes from all 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
[Form] Documented the intl option in TimezoneType
  • Loading branch information
javiereguiluz committed Jul 3, 2019
commit d96e56e8d8c5607abe89b5664b23e7b501066633
28 changes: 28 additions & 0 deletions 28 reference/forms/types/timezone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ manually, but then you should just use the ``ChoiceType`` directly.
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
+-------------+------------------------------------------------------------------------+
| Options | - `input`_ |
| | - `intl`_ |
| | - `regions`_ |
+-------------+------------------------------------------------------------------------+
| Overridden | - `choices`_ |
| options | |
+-------------+------------------------------------------------------------------------+
| Inherited | from the :doc:`ChoiceType </reference/forms/types/choice>` |
| options | |
| | - `choice_translation_domain`_ |
| | - `expanded`_ |
| | - `multiple`_ |
| | - `placeholder`_ |
Expand Down Expand Up @@ -73,6 +75,28 @@ on your underlying object. Valid values are:

The ``intltimezone`` input type was introduced in Symfony 4.3.

intl
~~~~

*type**: ``boolean`` **default**: ``false``

.. versionadded:: 4.3

This option was introduced in Symfony 4.3.

If this option is set to ``true``, the timezone selector will display the
timezones from the `ICU Project`_ via the :doc:`Intl component </components/intl>`
instead of the regular PHP timezones.

Although both sets of timezones are pretty similar, only the ones from the Intl
component can be translated to any language. To do so, set the desired locale
with the ``choice_translation_locale`` option.

.. note::

The :doc:`Timezone constraint </reference/constraints/Timezone>` can validate
both timezone sets and adapts to the selected set automatically.

regions
~~~~~~~

Expand Down Expand Up @@ -105,6 +129,8 @@ Inherited Options

These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`:

.. include:: /reference/forms/types/options/choice_translation_domain.rst.inc
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add a note that this option can only be used when intl is set to true.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about that ... however, I saw that the code shows a perfect error message when you do that (see https://github.com/symfony/symfony/pull/31294/files#diff-c6198934d4f35bc102ff362d40b71285R72) so I guess it's fine to not add these implementation details in the docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's also more or less explained above. Works for me :)

Copy link
Member

Choose a reason for hiding this comment

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

My thought is that people will just notice this option and try to use it. But it's not a big deal. We can add something later anyway if we receive complaints about it not being straight-forward (the error provided by the form type is quite clear indeed).


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

.. include:: /reference/forms/types/options/multiple.rst.inc
Expand Down Expand Up @@ -152,3 +178,5 @@ The actual default value of this option depends on other field options:
.. include:: /reference/forms/types/options/mapped.rst.inc

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

.. _`ICU Project`: http://site.icu-project.org/
Morty Proxy This is a proxified and sanitized view of the page, visit original site.