function LoginLogoutMenuLink::getTitle

Same name in other branches
  1. 9 core/modules/user/src/Plugin/Menu/LoginLogoutMenuLink.php \Drupal\user\Plugin\Menu\LoginLogoutMenuLink::getTitle()
  2. 10 core/modules/user/src/Plugin/Menu/LoginLogoutMenuLink.php \Drupal\user\Plugin\Menu\LoginLogoutMenuLink::getTitle()
  3. 11.x core/modules/user/src/Plugin/Menu/LoginLogoutMenuLink.php \Drupal\user\Plugin\Menu\LoginLogoutMenuLink::getTitle()

Overrides MenuLinkDefault::getTitle

File

core/modules/user/src/Plugin/Menu/LoginLogoutMenuLink.php, line 58

Class

LoginLogoutMenuLink
A menu link that shows "Log in" or "Log out" as appropriate.

Namespace

Drupal\user\Plugin\Menu

Code

public function getTitle() {
    if ($this->currentUser
        ->isAuthenticated()) {
        return $this->t('Log out');
    }
    else {
        return $this->t('Log in');
    }
}

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