Impact
My solution listed in #2853164: Hierarchical entity select for select with Option Groups no longer works.
Problem
This code change in Drupal\webform\Element\WebformEntityTrait
is causing the select element to return blank and throw errors:
Warning: html_entity_decode() expects parameter 1 to be string, array given in Drupal\Component\Utility\Html::decodeEntities() (line 383 of core/lib/Drupal/Component/Utility/Html.php).
:
Error-causing code:
// Issue #2826451: TermSelection returning HTML characters in select list.
foreach ($options as $key => $value) {
$options[$key] = Html::decodeEntities($value);
}
Here is a screenshot of $value
being passed to Html::decodeEntities()
Possible solution
When I comment these lines of code, the optgroups is displayed correctly (albeit still with a dash prefix on every term).
Comment | File | Size | Author |
---|---|---|---|
#2 | entity_select_with-2857413-2.patch | 2.25 KB | jrockowitz |
| |||
optgroup_value.png | 3.56 KB | ptsimard | |
optgroup_error.png | 44.56 KB | ptsimard |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@ptsimard Please test the attached patch.
Comment #3
ptsimard CreditAttribution: ptsimard commentedHey thanks a lot for the amazingly fast fix. It seems to be working fine!
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedNo problem. I am trying to keep the simple things... simple and trying to make the complex things... simple.
Fixing this was pretty simple.
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented