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

merge-requests/2419/head
Alex Pott 2019-11-29 13:18:16 +00:00
parent c314cda04d
commit c202dbde45
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
1 changed files with 7 additions and 0 deletions

View File

@ -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() {