@@ -28,22 +28,87 @@ Field Options
28
28
Overridden Options
29
29
------------------
30
30
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
+
31
53
``choices ``
32
54
~~~~~~~~~~~
33
55
34
56
**default **: ``Symfony\Component\Intl\Currencies::getNames() ``
35
57
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.
37
60
38
61
.. warning ::
39
62
40
63
If you want to override the built-in choices of the currency type, you
41
64
will also have to set the ``choice_loader `` option to ``null ``.
42
65
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
+
43
72
.. include :: /reference/forms/types/options/choice_translation_domain_disabled.rst.inc
44
73
45
74
.. include :: /reference/forms/types/options/invalid_message.rst.inc
46
75
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
+
47
112
Inherited Options
48
113
-----------------
49
114
@@ -104,3 +169,4 @@ The actual default value of this option depends on other field options:
104
169
.. include :: /reference/forms/types/options/row_attr.rst.inc
105
170
106
171
.. _`3-letter ISO 4217` : https://en.wikipedia.org/wiki/ISO_4217
172
+ .. _`legal tender` : https://en.wikipedia.org/wiki/Legal_tender
0 commit comments