diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 1d37c9c6f6f..2c84b6bd35a 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -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 @@ -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:: diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 01ce0f7862d..e00488b31ba 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -23,6 +23,7 @@ objects from the database. | Inherited | from the :doc:`choice ` type: | | options | | | | - `placeholder`_ | +| | - `choice_translation_domain`_ | | | - `expanded`_ | | | - `multiple`_ | | | - `preferred_choices`_ | @@ -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 diff --git a/reference/forms/types/options/choice_translation_domain.rst.inc b/reference/forms/types/options/choice_translation_domain.rst.inc new file mode 100644 index 00000000000..1d42f222e2e --- /dev/null +++ b/reference/forms/types/options/choice_translation_domain.rst.inc @@ -0,0 +1,15 @@ +choice_translation_domain +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.7 + 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.