- First commit to issue fork.
- Merge request !6405issues:2826451 TermSelection returning HTML characters in select list fixes → (Open) created by shalini_jha
- Status changed to Needs review
11 months ago 10:56am 31 January 2024 - 🇮🇳India shalini_jha
Hello everyone,
I was able to replicate this issue in version 11.x. Here are the steps to reproduce:Step 1) Create a taxonomy term in the tag vocabulary as follows:
a) Billing&Insurance
b) edit < me
c) helloStep 2) In my Case I have call this code for a select list of taxonomy term based on vocabulary, so I added the following code to retrieve the list of all terms in the tags vocabulary:
$selection_handler_options = [ "target_type" => "taxonomy_term", "handler" => "default:taxonomy_term", "handler_settings" => [ "target_bundles" => [ "departments" => "tags" ], ], ]; $selection_manager = \Drupal::service('plugin.manager.entity_reference_selection'); $handler = $selection_manager->getInstance($selection_handler_options); $referenceable_entities = $handler->getReferenceableEntities();
Step 3) The output is displaying HTML tags for special characters in option list.
array:1 [▼ "tags" => array:3 [▼ 3 => "Billing&Insurance" 2 => "edit < me" 1 => "hello" ] ]
Upon debugging the code, I found that Html::escape is added in the getReferenceableEntities method for rendering the options. Once I removed this Html::escape, the output displayed without HTML tags.
array:1 [▼ "tags" => array:3 [▼ 3 => "Billing&Insurance" 2 => "edit < me" 1 => "hello" ] ]
I couldn't identify the purpose of the changes in the test file. I've submitted a merge request for this. Please review
- Status changed to Needs work
11 months ago 3:19pm 2 February 2024 - 🇺🇸United States smustgrave
Not sure about the solution.
Regardless need a test case showing the issue.