You are here

private function OverviewForm::getUserData in Admin Audit Trail 1.0.x

Get User data.

Parameters

int $uid: The user ID.

Return value

Drupal\Core\Link The internal link for the user.

1 call to OverviewForm::getUserData()
OverviewForm::buildForm in src/OverviewForm.php
Form constructor.

File

src/OverviewForm.php, line 79

Class

OverviewForm
Configure user settings for this site.

Namespace

Drupal\admin_audit_trail

Code

private function getUserData($uid) {
  if (empty($uid)) {
    return Markup::create('<em>' . $this
      ->t('Anonymous') . '</em>');
  }
  $account = $this->entityTypeManager
    ->getStorage('user')
    ->load($uid);
  if (empty($account)) {
    return Markup::create('<em>' . $this
      ->t('@uid (deleted)', [
      '@uid' => $uid,
    ]) . '<em>');
  }
  return Link::fromTextAndUrl($account
    ->getDisplayname(), Url::fromUri('internal:/user/' . $account
    ->id()));
}