X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fuser%2Fuser.api.php;h=01e460233f0c6199a85c6aee9ae56e3af31bc395;hp=1fc0140fe8b26de0effd1bd15b7e2845b9d5df02;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hpb=9424afc6c1f518c301bf87a23c047d1873435d05 diff --git a/web/core/modules/user/user.api.php b/web/core/modules/user/user.api.php index 1fc0140fe..01e460233 100644 --- a/web/core/modules/user/user.api.php +++ b/web/core/modules/user/user.api.php @@ -110,7 +110,8 @@ function hook_user_cancel_methods_alter(&$methods) { * * Called by $account->getDisplayName() to allow modules to alter the username * that is displayed. Can be used to ensure user privacy in situations where - * $account->getDisplayName() is too revealing. + * $account->getDisplayName() is too revealing. This hook is invoked both for + * user entities and the anonymous user session object. * * @param string|Drupal\Component\Render\MarkupInterface $name * The username that is displayed for a user. If a hook implementation changes @@ -118,7 +119,14 @@ function hook_user_cancel_methods_alter(&$methods) { * the implementation to ensure the user's name is escaped properly. String * values will be autoescaped. * @param \Drupal\Core\Session\AccountInterface $account - * The user object on which the operation is being performed. + * The object on which the operation is being performed. This object may be a + * user entity. If the object is an implementation of UserInterface you can + * use instanceof operator before accessing user entity methods. For example: + * @code + * if ($account instanceof UserInterface) { + * // Access user entity methods. + * } + * @endcode * * @see \Drupal\Core\Session\AccountInterface::getDisplayName() * @see sanitization