8000 Merge branch '3.4' into 4.3 · symfony/symfony-docs@347cb7f · GitHub
[go: up one dir, main page]

Skip to content

Commit 347cb7f

Browse files
committed
Merge branch '3.4' into 4.3
* 3.4: [Form] Minor reword in the Choice type
2 parents 930dbec + 52aaff6 commit 347cb7f

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
@@ -59,8 +59,9 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op
5959
Example Usage
6060
-------------
6161

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

6566
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
6667
// ...

reference/forms/types/dateinterval.rst

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

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

8993
placeholder
9094
~~~~~~~~~~~
@@ -113,7 +117,11 @@ hours
113117
List of hours available to the hours field type. This option is only relevant
114118
when the ``widget`` option is set to ``choice``::
115119

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

118126
input
119127
~~~~~
@@ -158,7 +166,11 @@ minutes
158166
List of minutes available to the minutes field type. This option is only relevant
159167
when the ``widget`` option is set to ``choice``::
160168

161-
'minutes' => range(1, 60)
169+
// values displayed to users range from 0 to 59 (both inclusive)
170+
'minutes' => range(1, 60),
171+
172+
// values displayed to users range from 1 to 60 (both inclusive)
173+
'minutes' => array_combine(range(1, 60), range(1, 60)),
162174

163175
months
164176
~~~~~~
@@ -168,7 +180,11 @@ months
168180
List of months available to the months field type. This option is only relevant
169181
when the ``widget`` option is set to ``choice``::
170182

171-
'months' => range(1, 12)
183+
// values displayed to users range from 0 to 11 (both inclusive)
184+
'months' => range(1, 12),
185+
186+
// values displayed to users range from 1 to 12 (both inclusive)
187+
'months' => array_combine(range(1, 12), range(1, 12)),
172188

173189
seconds
174190
~~~~~~~
@@ -178,7 +194,11 @@ seconds
178194
List of seconds available to the seconds field type. This option is only relevant
179195
when the ``widget`` option is set to ``choice``::
180196

181-
'seconds' => range(1, 60)
197+
// values displayed to users range from 0 to 59 (both inclusive)
198+
'seconds' => range(1, 60),
199+
200+
// values displayed to users range from 1 to 60 (both inclusive)
201+
'seconds' => array_combine(range(1, 60), range(1, 60)),
182202

183203
weeks
184204
~~~~~
@@ -188,7 +208,11 @@ weeks
188208
List of weeks available to the weeks field type. This option is only relevant
189209
when the ``widget`` option is set to ``choice``::
190210

191-
'weeks' => range(1, 52)
211+
// values displayed to users range from 0 to 51 (both inclusive)
212+
'weeks' => range(1, 52),
213+
214+
// values displayed to users range from 1 to 52 (both inclusive)
215+
'weeks' => array_combine(range(1, 52), range(1, 52)),
192216

193217
widget
194218
~~~~~~
@@ -301,7 +325,11 @@ years
301325
List of years available to the years field type. This option is only relevant
302326
when the ``widget`` option is set to ``choice``::
303327

304-
'years' => range(1, 100)
328+
// values displayed to users range from 0 to 99 (both inclusive)
329+
'years' => range(1, 100),
330+
331+
// values displayed to users range from 1 to 100 (both inclusive)
332+
'years' => array_combine(range(1, 100), range(1, 100)),
305333

306334
Inherited Options
307335
-----------------

0 commit comments

Comments
 (0)
0