You are here

public function LoginLogoutMenuLink::getTitle in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/src/Plugin/Menu/LoginLogoutMenuLink.php \Drupal\user\Plugin\Menu\LoginLogoutMenuLink::getTitle()

Returns the localized title to be shown for this link.

Return value

string The title of the menu link.

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