From c202dbde455afdabfd31cbc467cf13956c01d4ae Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Fri, 29 Nov 2019 13:18:16 +0000 Subject: [PATCH] Issue #2988432 by msankhala, gaurav.kapoor, ravi.shankar, vimal_nadar, joachim, vacho, Berdir, leanderl: Drupal::currentUser() should give sample code to get the current user entity --- core/lib/Drupal.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php index 13ea129bd4f..cbf932f2b32 100644 --- a/core/lib/Drupal.php +++ b/core/lib/Drupal.php @@ -251,6 +251,13 @@ class Drupal { /** * Gets the current active user. * + * This method will return the \Drupal\Core\Session\AccountProxy object of the + * current user. You can use the \Drupal\user\Entity\User::load() method to + * load the full user entity object. For example: + * @code + * $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id()); + * @endcode + * * @return \Drupal\Core\Session\AccountProxyInterface */ public static function currentUser() {