public function Loader::loadCurrentUser in Bamboo Twig 8.2
Same name and namespace in other branches
- 8.5 bamboo_twig_loader/src/TwigExtension/Loader.php \Drupal\bamboo_twig_loader\TwigExtension\Loader::loadCurrentUser()
- 8.3 bamboo_twig_loader/src/TwigExtension/Loader.php \Drupal\bamboo_twig_loader\TwigExtension\Loader::loadCurrentUser()
- 8.4 bamboo_twig_loader/src/TwigExtension/Loader.php \Drupal\bamboo_twig_loader\TwigExtension\Loader::loadCurrentUser()
Return the current user object.
Return value
\Drupal\user\Entity\User|null The current user object or NULL when anonymous.
File
- bamboo_twig_loader/
src/ TwigExtension/ Loader.php, line 99
Class
- Loader
- Provides some loaders as Twig Extensions.
Namespace
Drupal\bamboo_twig_loader\TwigExtensionCode
public function loadCurrentUser() {
$currentUser = $this
->getCurrentUser();
if ($currentUser
->isAnonymous()) {
return NULL;
}
return $this
->getUserStorage()
->load($currentUser
->id());
}