8000 merged branch TomAdam/pr-choice-bc-doc (PR #5263) · lchenay/symfony@24e2fcb · GitHub
[go: up one dir, main page]

Skip to content

Commit 24e2fcb

Browse files
committed
merged branch TomAdam/pr-choice-bc-doc (PR symfony#5263)
Commits ------- 9e3e589 Alter upgrade notes with changes to _form_is_choice_selected twig function Discussion ---------- Undocumented BC break - choice field type template The upgrade notes for the choice field template are out of date. They currently state: ``` The `choices` variable now contains `ChoiceView` objects with two getters, getValue() and getLabel(), to access the choice data. ``` However these methods do not exist. I assume this is the result of a rollback to maintain BC? In addition to this, the `_form_is_choice_selected` twig function has been removed and replaced with a filter called `selectedchoice`. This is an undocumented BC break. I have attached an update to the notes to reflect these changes. --------------------------------------------------------------------------- by fabpot at 2012-08-15T17:20:35Z ping @bschussek --------------------------------------------------------------------------- by bschussek at 2012-08-16T17:36:22Z Looks good apart from my comment. Thanks for fixing this!
2 parents 6d74031 + 9e3e589 commit 24e2fcb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

UPGRADE-2.1.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,9 @@
532532
by default. Take care if your JavaScript relies on that. If you want to
533533
read the actual choice value, read the `value` attribute instead.
534534
535-
* In the choice field type's template, the structure of the `choices` variable
536-
has changed.
537-
538-
The `choices` variable now contains `ChoiceView` objects with two getters,
539-
`getValue()` and `getLabel()`, to access the choice data.
535+
* In the choice field type's template, the `_form_is_choice_selected` method
536+
used to identify a selected choice has been replaced with the `selectedchoice`
537+
filter.
540538
541539
Before:
542540
@@ -551,9 +549,9 @@
551549
After:
552550
553551
```
554-
{% for choice in choices %}
555-
<option value="{{ choice.value }}"{% if _form_is_choice_selected(form, choice) %} selected="selected"{% endif %}>
556-
{{ choice.label }}
552+
{% for choice, label in choices %}
553+
<option value="{{ choice }}"{% if choice is selectedchoice(form) %} selected="selected"{% endif %}>
554+
{{ label }}
557555
</option>
558556
{% endfor %}
559557
```

0 commit comments

Comments
 (0)
0