public function ModalPage::getAutheticatedUserName in Modal 8.3
Same name and namespace in other branches
- 8.2 src/ModalPage.php \Drupal\modal_page\ModalPage::getAutheticatedUserName()
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 ModalPage::getAutheticatedUserName()
- ModalPage::checkModalToShow in src/
ModalPage.php - Function to check Modal will show.
File
- src/
ModalPage.php, line 225
Class
- ModalPage
- Modal Page Class.
Namespace
Drupal\modal_pageCode
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);
}