function UserUid::title

Get the title this argument will assign the view, given the argument.

This usually needs to be overridden to provide a proper title.

Overrides ArgumentPluginBase::title

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php, line 23
Definition of Drupal\comment\Plugin\views\argument\UserUid.

Class

UserUid
Argument handler to accept a user id to check for nodes that user posted or commented on.

Namespace

Drupal\comment\Plugin\views\argument

Code

function title() {
  if (!$this->argument) {
    $title = config('user.settings')
      ->get('anonymous');
  }
  else {
    $query = db_select('users', 'u');
    $query
      ->addField('u', 'name');
    $query
      ->condition('u.uid', $this->argument);
    $title = $query
      ->execute()
      ->fetchField();
  }
  if (empty($title)) {
    return t('No user');
  }
  return check_plain($title);
}