diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument/Uid.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument/Uid.php index 03c492a..4137ef1 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/argument/Uid.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument/Uid.php @@ -2,12 +2,12 @@ /** * @file - * Definition of Drupal\user\Plugin\views\argument\Uid. + * Contains \Drupal\user\Plugin\views\argument\Uid. */ namespace Drupal\user\Plugin\views\argument; -use Drupal\Component\Annotation\PluginID; +use Drupal\Component\Utility\String; use Drupal\views\Plugin\views\argument\Numeric; /** @@ -26,17 +26,9 @@ class Uid extends Numeric { * A list of usernames. */ public function titleQuery() { - if (!$this->argument) { - return array(\Drupal::config('user.settings')->get('anonymous')); - } - - $titles = array(); - - $users = user_load_multiple($this->value); - foreach ($users as $account) { - $titles[] = check_plain($account->label()); - } - return $titles; + return array_map(function($account) { + return String::checkPlain($account->label()); + }, user_load_multiple($this->value)); } } diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php index 95024af..1d6dacf 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php @@ -46,7 +46,12 @@ public function testArgumentTitle() { // Tests the anonymous user. $this->executeView($view, array(0)); - $this->assertEqual($view->getTitle(), config('user.settings')->get('anonymous')); + $this->assertEqual($view->getTitle(), \Drupal::config('user.settings')->get('anonymous')); + $view->destroy(); + + $view->getDisplay()->getHandler('argument', 'uid')->options['break_phrase'] = TRUE; + $this->executeView($view, array($account->id() . ',0')); + $this->assertEqual($view->getTitle(), $account->label() . ', ' . \Drupal::config('user.settings')->get('anonymous')); $view->destroy(); } diff --git a/core/modules/user/user.views.inc b/core/modules/user/user.views.inc index 4a5d894..9fa7e42 100644 --- a/core/modules/user/user.views.inc +++ b/core/modules/user/user.views.inc @@ -36,7 +36,7 @@ function user_views_data() { 'argument' => array( 'id' => 'user_uid', 'name field' => 'name', - 'empty field name' => config('user.settings')->get('anonymous'), + 'empty field name' => \Drupal::config('user.settings')->get('anonymous'), ), 'filter' => array( 'title' => t('Name'),