|
| 1 | +..index:: |
| 2 | + single: Forms; Fields; currency |
| 3 | + |
| 4 | +currency Field Type |
| 5 | +=================== |
| 6 | + |
| 7 | +The ``currency`` type is a subset of the |
| 8 | +:doc:`choice type </reference/forms/types/choice` that allows the user to |
| 9 | +select from a large list of `3-letter ISO 4217`_ currencies. |
| 10 | + |
| 11 | +Unlike the ``choice`` type, you don't need to specify a ``choices`` or |
| 12 | +``choice_list`` option as the field type automatically uses a large list of |
| 13 | +currencies. You *can* specify either of these options manually, but then you |
| 14 | +should just use the ``choice`` type directly. |
| 15 | + |
| 16 | ++-------------+------------------------------------------------------------------------+ |
| 17 | +| Rendered as| can be various tags (see:ref:`forms-reference-choice-tags`)| |
| 18 | ++-------------+------------------------------------------------------------------------+ |
| 19 | +| Overridden| - `choices`_| |
| 20 | +| Options|| |
| 21 | ++-------------+------------------------------------------------------------------------+ |
| 22 | +| Inherited| - `multiple`_| |
| 23 | +| options| - `expanded`_| |
| 24 | +|| - `preferred_choices`_| |
| 25 | +|| - `empty_value`_| |
| 26 | +|| - `error_bubbling`_| |
| 27 | +|| - `required`_| |
| 28 | +|| - `label`_| |
| 29 | +|| - `read_only`_| |
| 30 | +|| - `disabled`_| |
| 31 | +|| - `mapped`_| |
| 32 | ++-------------+------------------------------------------------------------------------+ |
| 33 | +| Parent type|:doc:`choice</reference/forms/types/choice>`| |
| 34 | ++-------------+------------------------------------------------------------------------+ |
| 35 | +| Class|:class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CurrencyType`| |
| 36 | ++-------------+------------------------------------------------------------------------+ |
| 37 | + |
| 38 | +Overridden Options |
| 39 | +------------------ |
| 40 | + |
| 41 | +choices |
| 42 | +~~~~~~~ |
| 43 | + |
| 44 | +**default**: ``Symfony\Component\Intl\Intl::getCurrencyBundle()->getCurrencyNames()`` |
| 45 | + |
| 46 | +The choices option defaults to all currencies. |
| 47 | + |
| 48 | +Inherited options |
| 49 | +----------------- |
| 50 | + |
| 51 | +These options inherit from the:doc:`choice</reference/forms/types/choice>` type: |
| 52 | + |
| 53 | +..include::/reference/forms/types/options/multiple.rst.inc |
| 54 | + |
| 55 | +..include::/reference/forms/types/options/expanded.rst.inc |
| 56 | + |
| 57 | +..include::/reference/forms/types/options/preferred_choices.rst.inc |
| 58 | + |
| 59 | +..include::/reference/forms/types/options/empty_value.rst.inc |
| 60 | + |
| 61 | +..include::/reference/forms/types/options/error_bubbling.rst.inc |
| 62 | + |
| 63 | +These options inherit from the:doc:`date</reference/forms/types/form>` type: |
| 64 | + |
| 65 | +..include::/reference/forms/types/options/required.rst.inc |
| 66 | + |
| 67 | +..include::/reference/forms/types/options/label.rst.inc |
| 68 | + |
| 69 | +..include::/reference/forms/types/options/read_only.rst.inc |
| 70 | + |
| 71 | +..include::/reference/forms/types/options/disabled.rst.inc |
| 72 | + |
| 73 | +..include::/reference/forms/types/options/mapped.rst.inc |
| 74 | + |
| 75 | +.. _`3-letter ISO 4217`:http://en.wikipedia.org/wiki/ISO_4217 |