Skip to content
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

Added documentation for choice_translation_domain option #5906

Merged
merged 1 commit into from
Dec 31, 2015
Merged
Show file tree
Hide file tree
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
51 changes: 28 additions & 23 deletions reference/forms/types/choice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ would replace the ``choices`` option.

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

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

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

.. include:: /reference/forms/types/options/multiple.rst.inc
Expand Down Expand Up @@ -346,29 +348,32 @@ type:
Field Variables
---------------

+------------------------+--------------+-------------------------------------------------------------------+
| Variable | Type | Usage |
+========================+==============+===================================================================+
| multiple | ``boolean`` | The value of the `multiple`_ option. |
+------------------------+--------------+-------------------------------------------------------------------+
| expanded | ``boolean`` | The value of the `expanded`_ option. |
+------------------------+--------------+-------------------------------------------------------------------+
| preferred_choices | ``array`` | A nested array containing the ``ChoiceView`` objects of |
| | | choices which should be presented to the user with priority. |
+------------------------+--------------+-------------------------------------------------------------------+
| choices | ``array`` | A nested array containing the ``ChoiceView`` objects of |
| | | the remaining choices. |
+------------------------+--------------+-------------------------------------------------------------------+
| separator | ``string`` | The separator to use between choice groups. |
+------------------------+--------------+-------------------------------------------------------------------+
| placeholder | ``mixed`` | The empty value if not already in the list, otherwise |
| | | ``null``. |
+------------------------+--------------+-------------------------------------------------------------------+
| is_selected | ``callable`` | A callable which takes a ``ChoiceView`` and the selected value(s) |
| | | and returns whether the choice is in the selected value(s). |
+------------------------+--------------+-------------------------------------------------------------------+
| placeholder_in_choices | ``boolean`` | Whether the empty value is in the choice list. |
+------------------------+--------------+-------------------------------------------------------------------+
+----------------------------+--------------+-------------------------------------------------------------------+
| Variable | Type | Usage |
+============================+==============+===================================================================+
| multiple | ``boolean`` | The value of the `multiple`_ option. |
+----------------------------+--------------+-------------------------------------------------------------------+
| expanded | ``boolean`` | The value of the `expanded`_ option. |
+----------------------------+--------------+-------------------------------------------------------------------+
| preferred_choices | ``array`` | A nested array containing the ``ChoiceView`` objects of |
| | | choices which should be presented to the user with priority. |
+----------------------------+--------------+-------------------------------------------------------------------+
| choices | ``array`` | A nested array containing the ``ChoiceView`` objects of |
| | | the remaining choices. |
+----------------------------+--------------+-------------------------------------------------------------------+
| separator | ``string`` | The separator to use between choice groups. |
+----------------------------+--------------+-------------------------------------------------------------------+
| placeholder | ``mixed`` | The empty value if not already in the list, otherwise |
| | | ``null``. |
+----------------------------+--------------+-------------------------------------------------------------------+
| choice_translation_domain | ``mixed`` | ``boolean``, ``null`` or ``string`` to determine if the value |
| | | should be translated. |
+----------------------------+--------------+-------------------------------------------------------------------+
| is_selected | ``callable`` | A callable which takes a ``ChoiceView`` and the selected value(s) |
| | | and returns whether the choice is in the selected value(s). |
+----------------------------+--------------+-------------------------------------------------------------------+
| placeholder_in_choices | ``boolean`` | Whether the empty value is in the choice list. |
+----------------------------+--------------+-------------------------------------------------------------------+

.. tip::

Expand Down
3 changes: 3 additions & 0 deletions reference/forms/types/entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ objects from the database.
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type: |
| options | |
| | - `placeholder`_ |
| | - `choice_translation_domain`_ |
| | - `expanded`_ |
| | - `multiple`_ |
| | - `preferred_choices`_ |
Expand Down Expand Up @@ -195,6 +196,8 @@ type:

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

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

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

.. include:: /reference/forms/types/options/multiple.rst.inc
Expand Down
15 changes: 15 additions & 0 deletions reference/forms/types/options/choice_translation_domain.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
choice_translation_domain
~~~~~~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 2.7
Copy link
Member

Choose a reason for hiding this comment

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

According to the original PR, this option was added in Symfony 2.8: symfony/symfony@3909460

Copy link
Member

Choose a reason for hiding this comment

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

Forget my previous comment. In 2.8 we added support for this option in date-related types.

The ``choice_translation_domain`` option was introduced in Symfony 2.7.

**type**: ``string``, ``boolean`` or ``null``

This option determines if the choice values should be translated and in which
translation domain.

The values of the ``choice_translation_domain`` option can be ``true`` (reuse the current
translation domain), ``false`` (disable translation), ``null`` (uses the parent translation
domain or the default domain) or a string which represents the exact translation
domain to use.