Skip to content

Commit

Permalink
feature #5906 Added documentation for choice_translation_domain optio…
Browse files Browse the repository at this point in the history
…n (peterrehm)

This PR was merged into the 2.7 branch.

Discussion
----------

Added documentation for choice_translation_domain option

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes #13651
| Applies to    | Symfony 2.7+
| Fixed tickets | -

Commits
-------

43f4125 Added documentation for choice_translation_domain option
  • Loading branch information
xabbuh committed Dec 31, 2015
2 parents d2f58e0 + 43f4125 commit a23e753
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 23 deletions.
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
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.

0 comments on commit a23e753

Please sign in to comment.