Unverified Commit ad9f72e1 authored by alexpott's avatar alexpott

Issue #3000240 by govind.maloo, philipnorton42, msankhala, izus, scott_euser,...

Issue #3000240 by govind.maloo, philipnorton42, msankhala, izus, scott_euser, joachim, alexpott, catch: hook_user_format_name_alter() should document that it's invoked for both user entities and session objects

(cherry picked from commit b6208e52)
parent 0b2d0e37
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment