Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9d00f0b

Browse filesBrowse files
committed
feature #6282 [Form] fix choice_label values (HeahDude)
This PR was merged into the 2.7 branch. Discussion ---------- [Form] fix `choice_label` values | Q | A | ------------- | --- | Doc fix? | yes | New docs? | kind of | Applies to | 2.7+ | Fixed tickets | n/a This PR is a complement of symfony/symfony#17798, which allows handling `false` as `choice_label` value in `ChoiceType` and its inheritance. Not sure about the phrasing but this is the idea, suggestions are welcome ! Commits ------- 73f1935 [Form] fix `choice_label` values
2 parents 0e56ff9 + 73f1935 commit 9d00f0b
Copy full SHA for 9d00f0b

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎reference/forms/types/options/choice_label.rst.inc

Copy file name to clipboardExpand all lines: reference/forms/types/options/choice_label.rst.inc
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ choice_label
44
.. versionadded:: 2.7
55
The ``choice_label`` option was introduced in Symfony 2.7.
66

7-
**type**: ``callable`` or ``string`` **default**: ``null``
7+
**type**: ``string``, ``bool``, ``callable`` or ``PropertyPath`` **default**: ``null``
88

99
Normally, the array key of each item in the ``choices`` option is used as the
1010
text that's shown to the user. The ``choice_label`` option allows you to take
@@ -48,3 +48,7 @@ If your choice values are objects, then ``choice_label`` can also be a
4848
'choices_as_values' => true,
4949
'choice_label' => 'displayName',
5050
));
51+
52+
If set to ``false``, all the tag labels will be discarded for radio or checkbox
53+
inputs. You can also return ``false`` from the callable to discard only the label
54+
of the processed tag.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.