diff --git a/components/ILIAS/User/src/Search/class.EndpointGUI.php b/components/ILIAS/User/src/Search/class.EndpointGUI.php index e61ef4adb64e..d8b84bd033b4 100644 --- a/components/ILIAS/User/src/Search/class.EndpointGUI.php +++ b/components/ILIAS/User/src/Search/class.EndpointGUI.php @@ -100,28 +100,28 @@ private function buildResponse(): string ]) ); - $response = array_values( - array_reduce( - array_merge( - $this->endpoint_configurator->getAdditionalAnswerElements( - $this->current_user, - $autocomplete_query - ), - $this->profile_data_repository->searchUsers( - $this->settings_data_repository, - $this->field_configuration_repository, - $autocomplete_query - ) + $response = array_reduce( + array_merge( + $this->endpoint_configurator->getAdditionalAnswerElements( + $this->current_user, + $autocomplete_query ), - static function (array $c, AutocompleteItem $v): array { - $tag_array = $v->getTagArray(); - $c[$tag_array['display']] = $tag_array; - return $c; - }, - [] - ) + $this->profile_data_repository->searchUsers( + $this->settings_data_repository, + $this->field_configuration_repository, + $autocomplete_query + ) + ), + static function (array $carry, AutocompleteItem $item): array { + $tag_array = $item->getTagArray(); + $carry[$tag_array['display']] = $tag_array; + return $carry; + }, + [] ); + $response = array_values($response); + usort( $response, fn(array $a, array $b): int => $a['display'] <=> $b['display']