public function ModalPageService::getAutheticatedUserName in Modal 5.0.x
Get user name authenticate.
Parameters
string $text: The body text of modal.
Return value
string The text with user name or visitor text.
1 call to ModalPageService::getAutheticatedUserName()
- ModalPageService::checkModalToShow in src/
Service/ ModalPageService.php - Function to check Modal will show.
File
- src/
Service/ ModalPageService.php, line 254
Class
- ModalPageService
- Modal Page Service Class.
Namespace
Drupal\modal_page\ServiceCode
public function getAutheticatedUserName($text) : string {
if ($this->currentUser
->isAuthenticated()) {
return str_replace('@user_name@', $this->currentUser
->getAccountName(), $text);
}
return str_replace('@user_name@', $this
->t('visitor'), $text);
}