@@ -28,22 +28,87 @@ Field Options
2828Overridden Options
2929------------------
3030
31+ ``active_at ``
32+ ~~~~~~~~~~~~~
33+
34+ **type **: ``\DateTimeInterface::class `` or ``null `` **default **: ``null ``
35+
36+ An active currency is one that is still in use today as `legal tender `_
37+ somewhere. This option allows you to show only the currencies that are active
38+ at that date:
39+
40+ use Symfony\C omponent\F orm\E xtension\C ore\T ype\C urrencyType;
41+
42+ $builder->add('currency', CurrencyType::class, [
43+ 'active_at' => new \D ateTimeImmutable('2007-01-15', new \D ateTimeZone('Etc/UTC')),
44+ ]);
45+
46+ In the previous example, the list of currences won't include items like the
47+ Slovenian Tolar, which stopped being used on January 14, 2007.
48+
49+ .. versionadded :: 7.4
50+
51+ The ``active_at `` option was introduced in Symfony 7.4.
52+
3153``choices ``
3254~~~~~~~~~~~
3355
3456**default **: ``Symfony\Component\Intl\Currencies::getNames() ``
3557
36- The choices option defaults to all currencies.
58+ The ``choices `` option defaults to all currencies that are `legal tender `_ at
59+ the moment of creating the form type.
3760
3861.. warning ::
3962
4063 If you want to override the built-in choices of the currency type, you
4164 will also have to set the ``choice_loader `` option to ``null ``.
4265
66+ .. versionadded :: 7.4
67+
68+ The default value of ``choices `` changed in Symfony 7.4. In previous versions,
69+ this option contained all currencies, including those that were no longer legal
70+ tender in their countries.
71+
4372.. include :: /reference/forms/types/options/choice_translation_domain_disabled.rst.inc
4473
4574.. include :: /reference/forms/types/options/invalid_message.rst.inc
4675
76+ ``legal_tender ``
77+ ~~~~~~~~~~~~~~~~
78+
79+ **type **: ``boolean `` or ``null `` **default **: ``true ``
80+
81+ Set this option to ``false `` to only display the currencies that are no longer
82+ `legal tender `_ in their countries. Set it to ``null `` to include all curencies,
83+ regardless of their legal tender status.
84+
85+ .. versionadded :: 7.4
86+
87+ The ``legal_tender `` option was introduced in Symfony 7.4.
88+
89+ .. include :: /reference/forms/types/options/choice_translation_domain.rst.inc
90+
91+ ``not_active_at ``
92+ ~~~~~~~~~~~~~~~~~
93+
94+ **type **: ``\DateTimeInterface::class `` or ``null `` **default **: ``null ``
95+
96+ An inactive currency is one that is a legacy currency, no longer in circulation.
97+ This option allows you to show only the currencies that are inactive at that date:
98+
99+ use Symfony\C omponent\F orm\E xtension\C ore\T ype\C urrencyType;
100+
101+ $builder->add('currency', CurrencyType::class, [
102+ 'not_active_at' => new \D ateTimeImmutable('2007-01-15', new \D ateTimeZone('Etc/UTC')),
103+ ]);
104+
105+ In the previous example, the list of currencies will include items like the
106+ Slovenian Tolar, which stopped being used on January 14, 2007.
107+
108+ .. versionadded :: 7.4
109+
110+ The ``not_active_at `` option was introduced in Symfony 7.4.
111+
47112Inherited Options
48113-----------------
49114
@@ -104,3 +169,4 @@ The actual default value of this option depends on other field options:
104169.. include :: /reference/forms/types/options/row_attr.rst.inc
105170
106171.. _`3-letter ISO 4217` : https://en.wikipedia.org/wiki/ISO_4217
172+ .. _`legal tender` : https://en.wikipedia.org/wiki/Legal_tender
0 commit comments