From 9d5d389de841705450190fb1ebbaa11393870dfe Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 20 Dec 2016 20:27:23 -0500 Subject: Display user full name in auto-complete field value --- app/Formatter/UserAutoCompleteFormatter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Formatter') diff --git a/app/Formatter/UserAutoCompleteFormatter.php b/app/Formatter/UserAutoCompleteFormatter.php index 32a83608..c81af00a 100644 --- a/app/Formatter/UserAutoCompleteFormatter.php +++ b/app/Formatter/UserAutoCompleteFormatter.php @@ -24,11 +24,11 @@ class UserAutoCompleteFormatter extends BaseFormatter implements FormatterInterf $users = $this->query->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name')->findAll(); foreach ($users as &$user) { - $user['value'] = $user['username'].' (#'.$user['id'].')'; - if (empty($user['name'])) { + $user['value'] = $user['username'].' (#'.$user['id'].')'; $user['label'] = $user['username']; } else { + $user['value'] = $user['name'].' (#'.$user['id'].')'; $user['label'] = $user['name'].' ('.$user['username'].')'; } } -- cgit v1.2.3