- Issue created by @robpowell
- πΊπΈUnited States robpowell Boston
Looks like this issue is related to realname/src/Controller/RealnameAutocompleteController.php
/** @var \Drupal\user\Entity\User $account */ foreach ($accounts as $account) { $matches[] = [ 'value' => $this->t('@realname (@id)', [ '@realname' => $account->getDisplayName(), '@id' => $account->id(), ]), 'label' => $this->t('@realname (@username)', [ '@realname' => $account->getDisplayName(), '@username' => $account->getAccountName(), ]), ]; }
t() will escape special characters. It looks like we could leverage some of the code from the controller this overrides core/lib/Drupal/Core/Entity/EntityAutocompleteMatcher.php
// Loop through the entities and convert them into autocomplete output. foreach ($entity_labels as $values) { foreach ($values as $entity_id => $label) { $key = "$label ($entity_id)"; // Strip things like starting/trailing white spaces, line breaks and // tags. $key = preg_replace('/\s\s+/', ' ', str_replace("\n", '', trim(Html::decodeEntities(strip_tags($key))))); // Names containing commas or quotes must be wrapped in quotes. $key = Tags::encode($key); $matches[] = ['value' => $key, 'label' => $label]; } }
- Status changed to Needs review
over 1 year ago 1:19pm 23 March 2023 - @robpowell opened merge request.