function LinkBase::currentUser

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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 111

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.