8000 minor #12054 [Form] Minor reword in the Choice type (javiereguiluz) · symfony/symfony-docs@52aaff6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 52aaff6

Browse files
committed
minor #12054 [Form] Minor reword in the Choice type (javiereguiluz)
This PR was squashed before being merged into the 3.4 branch (closes #12054). Discussion ---------- [Form] Minor reword in the Choice type This will hopefully avoid issues like #11925. Commits ------- e76a409 [Form] Minor reword in the Choice type
2 parents 4fd32aa + e76a409 commit 52aaff6

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

reference/forms/types/choice.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op
5252
Example Usage
5353
-------------
5454

55-
The easiest way to use this field is to specify the choices directly via
56-
the ``choices`` option::
55+
The easiest way to use this field is to define the ``choices`` option to specify
56+
the choices as an associative array where the keys are the labels displayed to
57+
end users and the array values are the internal values used in the form field::
5758

5859
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
5960
// ...

reference/forms/types/dateinterval.rst

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ days
8383
List of days available to the days field type. This option is only relevant
8484
when the ``widget`` option is set to ``choice``::
8585

86-
'days' => range(1, 31)
86+
// values displayed to users range from 0 to 30 (both inclusive)
87+
'days' => range(1, 31),
88+
89+
// values displayed to users range from 1 to 31 (both inclusive)
90+
'days' => array_combine(range(1, 31), range(1, 31)),
8791

8892
placeholder
8993
~~~~~~~~~~~
@@ -112,7 +116,11 @@ hours
112116
List of hours available to the hours field type. This option is only relevant
113117
when the ``widget`` option is set to ``choice``::
114118

115-
'hours' => range(1, 24)
119+
// values displayed to users range from 0 to 23 (both inclusive)
120+
'hours' => range(1, 24),
121+
122+
// values displayed to users range from 1 to 24 (both inclusive)
123+
'hours' => array_combine(range(1, 24), range(1, 24)),
116124

117125
input
118126
~~~~~
@@ -161,7 +169,11 @@ minutes
161169
List of minutes available to the minutes field type. This option is only relevant
162170
when the ``widget`` option is set to ``choice``::
163171

164-
'minutes' => range(1, 60)
172+
// values displayed to users range from 0 to 59 (both inclusive)
173+
'minutes' => range(1, 60),
174+
175+
// values displayed to users range from 1 to 60 (both inclusive)
176+
'minutes' => array_combine(range(1, 60), range(1, 60)),
165177

166178
months
167179
~~~~~~
@@ -171,7 +183,11 @@ months
171183
List of months available to the months field type. This option is only relevant
172184
when the ``widget`` option is set to ``choice``::
173185

174-
'months' => range(1, 12)
186+
// values displayed to users range from 0 to 11 (both inclusive)
187+
'months' => range(1, 12),
188+
189+
// values displayed to users range from 1 to 12 (both inclusive)
190+
'months' => array_combine(range(1, 12), range(1, 12)),
175191

176192
seconds
177193
~~~~~~~
@@ -181,7 +197,11 @@ seconds
181197
List of seconds available to the seconds field type. This option is only relevant
182198
when the ``widget`` option is set to ``choice``::
183199

184-
'seconds' => range(1, 60)
200+
// values displayed to users range from 0 to 59 (both inclusive)
201+
'seconds' => range(1, 60),
202+
203+
// values displayed to users range from 1 to 60 (both inclusive)
204+
'seconds' => array_combine(range(1, 60), range(1, 60)),
185205

186206
weeks
187207
~~~~~
@@ -191,7 +211,11 @@ weeks
191211
List of weeks available to the weeks field type. This option is only relevant
192212
when the ``widget`` option is set to ``choice``::
193213

194-
'weeks' => range(1, 52)
214+
// values displayed to users range from 0 to 51 (both inclusive)
215+
'weeks' => range(1, 52),
216+
217+
// values displayed to users range from 1 to 52 (both inclusive)
218+
'weeks' => array_combine(range(1, 52), range(1, 52)),
195219

196220
widget
197221
~~~~~~
@@ -304,7 +328,11 @@ years
304328
List of years available to the years field type. This option is only relevant
305329
when the ``widget`` option is set to ``choice``::
306330

307-
'years' => range(1, 100)
331+
// values displayed to users range from 0 to 99 (both inclusive)
332+
'years' => range(1, 100),
333+
334+
// values displayed to users range from 1 to 100 (both inclusive)
335+
'years' => array_combine(range(1, 100), range(1, 100)),
308336

309337
Inherited Options
310338
-----------------

0 commit comments

Comments
 (0)
0