You are here

jsonapi_test_user.module in Drupal 9

Support module for JSON:API user hooks testing.

File

core/modules/jsonapi/tests/modules/jsonapi_test_user/jsonapi_test_user.module
View source
<?php

/**
 * @file
 * Support module for JSON:API user hooks testing.
 */
use Drupal\Core\Session\AccountInterface;

/**
 * Implements hook_user_format_name_alter().
 */
function jsonapi_test_user_user_format_name_alter(&$name, AccountInterface $account) {
  if ($account
    ->isAnonymous()) {
    $name = 'User ' . $account
      ->id();
  }
}