function JsonapiTestUserHooks::userFormatNameAlter

Same name and namespace in other branches
  1. 11.x core/modules/jsonapi/tests/modules/jsonapi_test_user/src/Hook/JsonapiTestUserHooks.php \Drupal\jsonapi_test_user\Hook\JsonapiTestUserHooks::userFormatNameAlter()

Implements hook_user_format_name_alter().

Attributes

#[Hook('user_format_name_alter')]

File

core/modules/jsonapi/tests/modules/jsonapi_test_user/src/Hook/JsonapiTestUserHooks.php, line 18

Class

JsonapiTestUserHooks
Hook implementations for jsonapi_test_user.

Namespace

Drupal\jsonapi_test_user\Hook

Code

public function userFormatNameAlter(&$name, AccountInterface $account) : void {
  if ($account->isAnonymous()) {
    $name = 'User ' . $account->id();
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.