You are here

protected function LinkBase::currentUser in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/field/LinkBase.php \Drupal\views\Plugin\views\field\LinkBase::currentUser()
  2. 10 core/modules/views/src/Plugin/views/field/LinkBase.php \Drupal\views\Plugin\views\field\LinkBase::currentUser()

Gets the current active user.

@todo: https://www.drupal.org/node/2105123 put this method in \Drupal\Core\Plugin\PluginBase instead.

Return value

\Drupal\Core\Session\AccountInterface The current user.

1 call to LinkBase::currentUser()
LinkBase::checkUrlAccess in core/modules/views/src/Plugin/views/field/LinkBase.php
Checks access to the link route.

File

core/modules/views/src/Plugin/views/field/LinkBase.php, line 124

Class

LinkBase
Field handler to present a link to an entity.

Namespace

Drupal\views\Plugin\views\field

Code

protected function currentUser() {
  if (!$this->currentUser) {
    $this->currentUser = \Drupal::currentUser();
  }
  return $this->currentUser;
}