diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php index a44ec0b..ada79ad 100644 --- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php @@ -294,10 +294,11 @@ protected static function matchEntityByTitle(SelectionInterface $handler, $input // More helpful error if there are only a few matching entities. $multiples = []; foreach ($entities as $id => $name) { - $multiples[] = strip_tags($name) . ' (' . $id . ')'; + $multiples[] = $name . ' (' . $id . ')'; } $params['@id'] = $id; - $form_state->setError($element, t('Multiple entities match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', ['%multiple' => implode('", "', $multiples)] + $params)); + // Call strip_tags as the % placeholder does not escape HTML entities. + $form_state->setError($element, t('Multiple entities match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', ['%multiple' => strip_tags(implode('", "', $multiples))] + $params)); } else { // Take the one and only matching entity.