You are here

public function LoginLogoutMenuLink::getTitle in SAML Authentication 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/Menu/LoginLogoutMenuLink.php \Drupal\samlauth\Plugin\Menu\LoginLogoutMenuLink::getTitle()
  2. 8.2 src/Plugin/Menu/LoginLogoutMenuLink.php \Drupal\samlauth\Plugin\Menu\LoginLogoutMenuLink::getTitle()

Returns the localized title to be shown for this link.

Return value

string The title of the menu link.

Overrides LoginLogoutMenuLink::getTitle

File

src/Plugin/Menu/LoginLogoutMenuLink.php, line 62

Class

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

Namespace

Drupal\samlauth\Plugin\Menu

Code

public function getTitle() {
  if ($this->currentUser
    ->isAuthenticated()) {
    $setting = 'logout_menu_item_title';
  }
  else {
    $setting = 'login_menu_item_title';
  }
  $title = $this->config
    ->get($setting);
  return $title ?: parent::getTitle();
}